From ef21826c5cb5b3d06ec4342a3713676dada1ef48 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Sat, 24 Sep 2022 10:42:13 -0700 Subject: [PATCH] send anonymous tweets --- commands/tweet.js | 25 +++++++++++++++++++------ config/config.js | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/commands/tweet.js b/commands/tweet.js index 2a8016e..551b66f 100644 --- a/commands/tweet.js +++ b/commands/tweet.js @@ -18,6 +18,14 @@ module.exports = { type: 3, required: true, }, + { + name: "use_vpn", + description: "Tweet from an anonymous account", + value: "use_vpn", + type: 3, + choices: [{ name: "true", value: "true" }], // this just makes it look like we are enabling it optionally, but all + required: false, // we care for is that args[1] exists to send an anonymous tweet. + }, ], SlashCommand: { /** @@ -29,20 +37,25 @@ module.exports = { */ run: async (client, interaction, args, { GuildDB }) => { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { - return interaction.send(`You are not allowed to use the bot in this channel.`); + return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } - let userID = interaction.member.user.id; - let avatar = interaction.member.user.avatar; + const userID = interaction.member.user.id; + const avatar = interaction.member.user.avatar; - const tweetEmbed = new EmbedBuilder() + let tweetEmbed = new EmbedBuilder() .setColor('#0099ff') .setTitle('New Twitter Notifciation') .setThumbnail('https://static.vecteezy.com/system/resources/previews/002/534/045/original/social-media-twitter-logo-blue-isolated-free-vector.jpg') - .setAuthor({ name: `${interaction.member.user.username}`, iconURL: `https://cdn.discordapp.com/avatars/${userID}/${avatar}.png` }) .setDescription(args[0].value) .setTimestamp() + if (client.exists(args[1])) { + tweetEmbed.setAuthor({ name: 'Anonymous', iconURL: 'https://www.pngkey.com/png/detail/230-2301779_best-classified-apps-default-user-profile.png' }) + } else { + tweetEmbed.setAuthor({ name: `${interaction.member.user.username}`, iconURL: `https://cdn.discordapp.com/avatars/${userID}/${avatar}.png` }) + } + if (client.exists(GuildDB.tweetChannel)) { const channel = interaction.guild.channels.cache.find(channel => channel.id === GuildDB.tweetChannel); if (!channel) { @@ -55,7 +68,7 @@ module.exports = { try { channel.send({ embeds: [tweetEmbed] }); } catch (err) { - return interaction.send(`<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required. `) + return interaction.send({ content: `<@${client.user.id}> Does not have permissions to send to the channel.\nMake sure your admins give <@${client.user.id}> access to all channels required.` }) } return interaction.send({ content: 'Tweeted!' }); } else { diff --git a/config/config.js b/config/config.js index f8b6df7..5fecf0d 100644 --- a/config/config.js +++ b/config/config.js @@ -2,7 +2,7 @@ require('dotenv').config(); module.exports = { Dev: "PROD.", - Version: "12.4.5", + Version: "12.5.0", Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot DefaultPrefix: "?", ServerID: "955668596745461830",