mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
Fix embed reply on unhandled error. Better error logging.
This commit is contained in:
1 parent
0414905f58
commit
344885bcac
1 file changed
+5
-2
@@ -1,5 +1,6 @@
|
|||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
|
const { EmbedBuilder } = require('discord.js');
|
||||||
const { Player } = require('discord-player');
|
const { Player } = require('discord-player');
|
||||||
const { token, embedColors } = require('./config.json');
|
const { token, embedColors } = require('./config.json');
|
||||||
|
|
||||||
@@ -110,7 +111,8 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
}' was executed successfully.`
|
}' was executed successfully.`
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
// log error to console with full object depth
|
||||||
|
console.dir(error, { depth: null });
|
||||||
console.log(
|
console.log(
|
||||||
`${new Date().toISOString().substring(11, 19)}: ${
|
`${new Date().toISOString().substring(11, 19)}: ${
|
||||||
interaction.guild.name
|
interaction.guild.name
|
||||||
@@ -118,12 +120,13 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
interaction.commandName
|
interaction.commandName
|
||||||
}' failed unexpectedly.`
|
}' failed unexpectedly.`
|
||||||
);
|
);
|
||||||
|
console.log(`Interaction input:\n${interaction}`);
|
||||||
|
|
||||||
await interaction.editReply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**Error**\nThere was an error while executing this command!\n\nIf this issue persists, please submit an issue in the support server: https://discord.gg/t6Bm8wPpXB`
|
`**Unexpected Error**\nThere was an error while executing this command! Please try again.\n\n_If this issue persists, please submit a bug report in the bot [support server](https://discord.gg/t6Bm8wPpXB)._`
|
||||||
)
|
)
|
||||||
.setColor(embedColors.colorError)
|
.setColor(embedColors.colorError)
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in new issue
Block a user