Updated event handlers to send error message only if prod
This commit is contained in:
@@ -41,23 +41,34 @@ export default function loadModalEvents(client: Client, ft: FileType) {
|
||||
try {
|
||||
await modal.execute(interaction)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
const channel = client.channels.cache.get(errorLogChannel) as GuildTextBasedChannel
|
||||
if (!channel) {
|
||||
console.log("No error log channel found.")
|
||||
}
|
||||
if (process.env.NODE_ENV !== "dev") {
|
||||
const channel = client.channels.cache.get(
|
||||
errorLogChannel,
|
||||
) as GuildTextBasedChannel
|
||||
if (!channel) {
|
||||
console.log("No error log channel found.")
|
||||
}
|
||||
|
||||
await channel.send({
|
||||
embeds: [{
|
||||
title: "Button error occured",
|
||||
description: String(error),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL({ forceStatic: false })!,
|
||||
text: interaction.user.username + " | " + interaction.customId
|
||||
}
|
||||
}],
|
||||
})
|
||||
await channel.send({
|
||||
embeds: [
|
||||
{
|
||||
title: "Button error occured",
|
||||
description: String(error),
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL({
|
||||
forceStatic: false,
|
||||
})!,
|
||||
text:
|
||||
interaction.user.username +
|
||||
" | " +
|
||||
interaction.customId,
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
console.error(error)
|
||||
await interaction.reply({
|
||||
content: "There was an error while executing this modal!",
|
||||
ephemeral: true,
|
||||
|
||||
Reference in New Issue
Block a user