mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
fix: Fixed execution time warnings and unexpected error
This commit is contained in:
1 parent
df9b0005ad
commit
da0519319d
1 file changed
+8
-4
@@ -124,8 +124,12 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
const executionTime = outputTime - inputTime;
|
const executionTime = outputTime - inputTime;
|
||||||
|
|
||||||
if (executionTime > 20000) {
|
if (executionTime > 20000) {
|
||||||
// don't send warning message for filters command, as collector timeout happens after 60 seconds
|
// don't send warning message for commands with collector timeouts, as collector timeout happens after 60 seconds
|
||||||
if (command.name === 'filters' && executionTime > 55000) {
|
if (
|
||||||
|
(interaction.commandName === 'filters' ||
|
||||||
|
interaction.commandName === 'nowplaying') &&
|
||||||
|
executionTime > 55000
|
||||||
|
) {
|
||||||
logger.info(
|
logger.info(
|
||||||
`(${interaction.guild.memberCount}) ${interaction.guild.name}> Command '${interaction}' executed in ${executionTime} ms.`
|
`(${interaction.guild.memberCount}) ${interaction.guild.name}> Command '${interaction}' executed in ${executionTime} ms.`
|
||||||
);
|
);
|
||||||
@@ -139,7 +143,7 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
// todo: using interaction.editReply() might lead to "unknown interaction" error
|
// todo: using interaction.editReply() might lead to "unknown interaction" error
|
||||||
// it might already have been replied to or deferred
|
// it might already have been replied to or deferred
|
||||||
// solution might be to use interaction.followUp() instead or send a message to the channel?
|
// solution might be to use interaction.followUp() instead or send a message to the channel?
|
||||||
return await interaction.editReply({
|
return await interaction.followUp({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -164,7 +168,7 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
// todo: using interaction.editReply() might lead to "unknown interaction" error
|
// todo: using interaction.editReply() might lead to "unknown interaction" error
|
||||||
// it might already have been replied to or deferred
|
// it might already have been replied to or deferred
|
||||||
// solution might be to use interaction.followUp() instead or send a message to the channel?
|
// solution might be to use interaction.followUp() instead or send a message to the channel?
|
||||||
await interaction.editReply({
|
await interaction.followUp({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
|
|||||||
Reference in new issue
Block a user