This commit is contained in:
Marius Begby committed 2023-08-12 18:14:23 +02:00
1 parent 529bfdde9c
commit 7527f8150c
1 file changed
+11 -14
+11 -14
View File
@@ -20,13 +20,17 @@ module.exports = {
try { try {
await command.autocomplete({ interaction, client }); await command.autocomplete({ interaction, client });
} catch (error) { } catch (error) {
if (error.message === 'Unknown interaction') { if (
error.message === 'Unknown interaction' ||
error.message === 'Interaction has already been acknowledged.'
) {
logger.debug( logger.debug(
`[Shard ${interaction.guild.shardId}] Autocomplete failed to be responded to, providing a response took too long.` `[Shard ${interaction.guild.shardId}] Autocomplete failed to be responded to, unknown interaction or already acknowledged.`
); );
return; return;
} else {
logger.warn(error, `[Shard ${interaction.guild.shardId}] Autocomplete failed to execute.`);
} }
logger.warn(error, `[Shard ${interaction.guild.shardId}] Autocomplete failed to execute.`);
return; return;
} }
} else if (interaction.isChatInputCommand()) { } else if (interaction.isChatInputCommand()) {
@@ -53,21 +57,14 @@ module.exports = {
); );
} }
} catch (error) { } catch (error) {
logger.error( logger.warn(
error, error,
`[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' failed to execute.` `[Shard ${interaction.guild.shardId}] Guild ${interaction.guild.id}> Command '${interaction}' throwed and error and might have failed to execute properly.`
); );
if (interaction.replied) { if (interaction.replied) {
await interaction.followUp({ // If the interaction has already been replied to, most likely command executed successfully or error is already handled.
embeds: [ return;
new EmbedBuilder()
.setDescription(
`**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to execute this command.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
)
.setColor(embedOptions.colors.error)
]
});
} else if (interaction.deferred) { } else if (interaction.deferred) {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [