better error handling

This commit is contained in:
SowinskiBraeden committed 2022-08-27 20:14:21 -07:00
1 parent ea799693de
commit 28b73e3a8f
14 files changed
+160 -157

No files matched your search

+10 -7
View File
@@ -45,18 +45,21 @@ class QuarksBot extends Client {
return await rest.post(Routes.interactionCallback(interaction.id, interaction.token), {
body: {
type: 4,
// data: typeof message == "string"
// ? { content: message, ...(message.ephemeral && {flags: (1 << 6)}), }
// : message.embeds[0] && message.embeds[0].type === "rich"
// ? { embeds: message.embeds, ...(message.ephemeral && {flags: (1 << 6)}), }
// : { message, ...(message.ephemeral && {flags: (1 << 6)}), },
data: message,
}
});
};
let cmd = client.commands.get(command);
if ((cmd.name == 'ping' || cmd.name == 'stats') && cmd.SlashCommand && cmd.SlashCommand.run) cmd.SlashCommand.run(this, interaction, args, { GuildDB }, start);
else if (cmd.SlashCommand && cmd.SlashCommand.run) cmd.SlashCommand.run(this, interaction, args, { GuildDB });
try {
cmd.SlashCommand.run(this, interaction, args, { GuildDB }, start); // start is only used in ping / stats command
} catch (err) {
client.error(err)
const embed = new EmbedBuilder()
.setDescription(`**Internal Error:**\nUh Oh D: Its not you, its me.\nThis command has crashed\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
.setColor(client.config.Colors.Red)
return interaction.send({ embeds: [embed] });
}
}
});