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