From fd573415f14a6510df6a483bece8e8b689c5cb12 Mon Sep 17 00:00:00 2001 From: Essem Date: Fri, 13 Aug 2021 21:36:13 -0500 Subject: [PATCH] Remove all references to reactions --- app.js | 4 +--- commands/general/count.js | 1 - commands/general/help.js | 1 - commands/general/image.js | 1 - commands/music/queue.js | 1 - commands/tags/tags.js | 1 - utils/pagination/awaitreactions.js | 38 ------------------------------ 7 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 utils/pagination/awaitreactions.js diff --git a/app.js b/app.js index 8486f9b..88c5779 100644 --- a/app.js +++ b/app.js @@ -78,9 +78,7 @@ const Admiral = new Fleet({ "guilds", "guildVoiceStates", "guildMessages", - "guildMessageReactions", - "directMessages", - "directMessageReactions" + "directMessages" ], stats: { requestTimeout: 30000 diff --git a/commands/general/count.js b/commands/general/count.js index 48cf792..0b93a78 100644 --- a/commands/general/count.js +++ b/commands/general/count.js @@ -4,7 +4,6 @@ const Command = require("../../classes/command.js"); class CountCommand extends Command { async run() { - if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("addReactions")) return "I don't have the `Add Reactions` permission!"; if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!"; const counts = await database.getCounts(); const countArray = []; diff --git a/commands/general/help.js b/commands/general/help.js index a2524cc..75f787f 100644 --- a/commands/general/help.js +++ b/commands/general/help.js @@ -51,7 +51,6 @@ class HelpCommand extends Command { } return embed; } else { - if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("addReactions")) return "I don't have the `Add Reactions` permission!"; if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!"; const pages = []; for (const category of Object.keys(help.categories)) { diff --git a/commands/general/image.js b/commands/general/image.js index c87c7ec..8fda098 100644 --- a/commands/general/image.js +++ b/commands/general/image.js @@ -6,7 +6,6 @@ const Command = require("../../classes/command.js"); class ImageSearchCommand extends Command { async run() { - if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("addReactions")) return "I don't have the `Add Reactions` permission!"; if (this.message.channel.guild && !this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!"; if (this.args.length === 0) return "You need to provide something to search for!"; this.client.sendChannelTyping(this.message.channel.id); diff --git a/commands/music/queue.js b/commands/music/queue.js index ad6ed69..be3b07b 100644 --- a/commands/music/queue.js +++ b/commands/music/queue.js @@ -11,7 +11,6 @@ class QueueCommand extends MusicCommand { if (!this.message.channel.guild) return "This command only works in servers!"; if (!this.message.member.voiceState.channelID) return "You need to be in a voice channel first!"; if (!this.message.channel.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!"; - if (!this.message.channel.permissionsOf(this.client.user.id).has("addReactions")) return "I don't have the `Add Reactions` permission!"; if (!this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!"; const queue = soundPlayer.queues.get(this.message.channel.guild.id); const player = this.connection; diff --git a/commands/tags/tags.js b/commands/tags/tags.js index e5cd5ff..764cd4a 100644 --- a/commands/tags/tags.js +++ b/commands/tags/tags.js @@ -41,7 +41,6 @@ class TagsCommand extends Command { if (!user) return `I couldn't find exactly who owns this tag, but I was able to get their ID: \`${tags[this.args[1].toLowerCase()].author}\``; return `This tag is owned by **${user.username}#${user.discriminator}** (\`${tags[this.args[1].toLowerCase()].author}\`).`; case "list": - if (!this.message.channel.permissionsOf(this.client.user.id).has("addReactions")) return "I don't have the `Add Reactions` permission!"; if (!this.message.channel.permissionsOf(this.client.user.id).has("embedLinks")) return "I don't have the `Embed Links` permission!"; var pageSize = 15; var embeds = []; diff --git a/utils/pagination/awaitreactions.js b/utils/pagination/awaitreactions.js deleted file mode 100644 index 16726a8..0000000 --- a/utils/pagination/awaitreactions.js +++ /dev/null @@ -1,38 +0,0 @@ -// eris doesn't come with an awaitReactions method by default, so we make our own -const EventEmitter = require("events").EventEmitter; - -class ReactionCollector extends EventEmitter { - constructor(client, message, filter, options = {}) { - super(); - this.filter = filter; - this.message = message; - this.options = options; - this.ended = false; - this.collected = []; - this.bot = client; - this.listener = async (message, emoji, member) => await this.verify(message, emoji, member); - this.bot.on("messageReactionAdd", this.listener); - if (options.time) setTimeout(() => this.stop("time"), options.time); - } - - async verify(message, emoji, member) { - if (this.message.id !== message.id) return false; - if (this.filter(message, emoji, member)) { - this.collected.push({ message: message, emoji: emoji, member: member }); - const msg = await this.bot.getMessage(message.channel.id, message.id); - this.emit("reaction", msg, emoji, member); - if (this.collected.length >= this.options.maxMatches) this.stop("maxMatches"); - return true; - } - return false; - } - - stop(reason) { - if (this.ended) return; - this.ended = true; - this.bot.removeListener("messageReactionAdd", this.listener); - this.emit("end", this.collected, reason); - } -} - -module.exports = ReactionCollector;