Skip to content

Commit 4dfed05

Browse files
committed
Purge confirmation deletion error fixed
Fixed an error that occurred if the user deleted a purge confirmation message that was scheduled to self-delete.
1 parent 471460d commit 4dfed05

File tree

1 file changed

+15
-2
lines changed
  • handlers/commands/chatCommands/purge

1 file changed

+15
-2
lines changed

handlers/commands/chatCommands/purge/purge.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,21 @@ export async function run(interaction, commandConfig, locale) {
6565
// Sends a confirmation message
6666
await interaction.reply({ embeds: [successEmbed] })
6767

68-
// If the purge channel is the same as the invocation, deletes confirmation at 5 seconds
69-
if (channel.id === interaction.channelId) setTimeout(() => interaction.deleteReply(), 5000);
68+
//Si el canal de la purga es el mismo que el de invocación, elimina la confirmación a los 5 segundos
69+
if (channel.id === interaction.channelId) setTimeout(async () => {
70+
71+
try {
72+
73+
// Elimina el mensaje de confirmación
74+
await interaction.deleteReply();
75+
76+
} catch (error) {
77+
78+
// Si el mensaje ya fue eliminado, no hace nada
79+
if (!error.toString().includes('DiscordAPIError: Unknown Message')) throw error;
80+
};
81+
82+
}, 5000);
7083

7184
// Sends a record to the records channel
7285
await client.functions.managers.sendLog('purgedChannel', 'embed', new discord.EmbedBuilder()

0 commit comments

Comments
 (0)