chore: catch errors and log them?
This commit is contained in:
parent
04fad613b6
commit
4964bf50e1
11
index.js
11
index.js
@ -22,6 +22,17 @@ client.on("ready", () => {
|
||||
console.log(`Logged in as ${client.user.tag}!`);
|
||||
});
|
||||
|
||||
// send message on error
|
||||
client.on("error", (error) => {
|
||||
console.error(error);
|
||||
let channel = client.channels.cache.get(COMMAND_CHANNEL_ID);
|
||||
if (!channel) return console.error("Can't find command channel");
|
||||
client.channels.cache
|
||||
.get(COMMAND_CHANNEL_ID)
|
||||
.send(`error: ${error.message}`)
|
||||
.catch(console.error);
|
||||
});
|
||||
|
||||
client.on("interactionCreate", async (interaction) => {
|
||||
const command = interaction.commandName;
|
||||
if (!interaction.isChatInputCommand()) return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user