From fd6369169ba62eb8f72f2bec126dc0e984bee81c Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Mon, 24 Jul 2023 23:18:36 +0200 Subject: [PATCH 1/3] fix: don't run permission validation on autocomplete interactions --- src/events/interactions/interactionCreate.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/events/interactions/interactionCreate.js b/src/events/interactions/interactionCreate.js index dc32561..b319b6b 100644 --- a/src/events/interactions/interactionCreate.js +++ b/src/events/interactions/interactionCreate.js @@ -7,10 +7,6 @@ module.exports = { name: Events.InteractionCreate, isDebug: false, execute: async (interaction, { client }) => { - if (await cannotSendMessageInChannel(interaction)) { - return; - } - const command = client.commands.get(interaction.commandName); if (!command) { logger.warn( @@ -34,6 +30,9 @@ module.exports = { } } else if (interaction.isChatInputCommand()) { try { + if (await cannotSendMessageInChannel(interaction)) { + return; + } const inputTime = new Date(); await interaction.deferReply(); From 57bc6c8d3fb0282fcb55f46c06b73a90b166723f Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Mon, 24 Jul 2023 23:21:53 +0200 Subject: [PATCH 2/3] fix: Update to 300 seconds timeout for collectorFilters --- src/commands/player/filters.js | 2 +- src/commands/player/nowplaying.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/player/filters.js b/src/commands/player/filters.js index 251eb68..58a8d38 100644 --- a/src/commands/player/filters.js +++ b/src/commands/player/filters.js @@ -89,7 +89,7 @@ module.exports = { try { const confirmation = await response.awaitMessageComponent({ filter: collectorFilter, - time: 60000 + time: 300_000 }); logger.debug( diff --git a/src/commands/player/nowplaying.js b/src/commands/player/nowplaying.js index 182bfc0..e684954 100644 --- a/src/commands/player/nowplaying.js +++ b/src/commands/player/nowplaying.js @@ -156,7 +156,7 @@ module.exports = { try { const confirmation = await response.awaitMessageComponent({ filter: collectorFilter, - time: 60000 + time: 300_000 }); confirmation.deferUpdate(); From 3b842f3cd549f946bb64f55ec6f4d56cc3980702 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Mon, 24 Jul 2023 23:22:08 +0200 Subject: [PATCH 3/3] fix: don't warn user about execution time --- src/events/interactions/interactionCreate.js | 23 -------------------- 1 file changed, 23 deletions(-) diff --git a/src/events/interactions/interactionCreate.js b/src/events/interactions/interactionCreate.js index b319b6b..fd3304a 100644 --- a/src/events/interactions/interactionCreate.js +++ b/src/events/interactions/interactionCreate.js @@ -42,32 +42,9 @@ module.exports = { const executionTime = outputTime - inputTime; if (executionTime > 20000) { - // don't send warning message for commands with collector timeouts, as collector timeout happens after 60 seconds - if ( - (interaction.commandName === 'filters' || interaction.commandName === 'nowplaying') && - executionTime > 55000 - ) { - logger.info( - `[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' executed in ${executionTime} ms.` - ); - return; - } - logger.warn( `[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' took ${executionTime} ms to execute.` ); - - return await interaction.followUp({ - embeds: [ - new EmbedBuilder() - .setDescription( - `**${embedOptions.icons.warning} Warning**\nThis command took ${ - executionTime / 1000 - } seconds to execute.\n\n_If you experienced problems with the command, please try again._` - ) - .setColor(embedOptions.colors.warning) - ] - }); } else { logger.info( `[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' executed in ${executionTime} ms.`