Skip to content

Commit 217bc55

Browse files
authored
Merge pull request #36 from neilenns/neilenns/issue35
Don't throw an error when people don't respond in time
2 parents 42bd0ee + c8da3ce commit 217bc55

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/commands/general/wiki.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const {
33
StringSelectMenuBuilder,
44
StringSelectMenuOptionBuilder,
55
SlashCommandBuilder,
6+
DiscordjsError,
67
hyperlink,
78
hideLinkEmbed,
89
} = require("discord.js");
@@ -134,12 +135,25 @@ module.exports = {
134135
content: `${preamble} ${link}`,
135136
});
136137
} catch (error) {
137-
logger.error(`Unable to send wiki link: ${error}`);
138-
await replyOrEditReply(interaction, {
139-
content: `Unable to send wiki link: ${error}`,
140-
components: [],
141-
ephemeral: true,
142-
});
138+
// Errors from the user not responding to the dropdown in time don't log,
139+
// they're just too noisy.
140+
if (
141+
error instanceof DiscordjsError &&
142+
error.code === "InteractionCollectorError"
143+
) {
144+
await replyOrEditReply(interaction, {
145+
content: `No response received, canceling sending the wiki link`,
146+
components: [],
147+
ephemeral: true,
148+
});
149+
} else {
150+
logger.error(`Unable to send wiki link: ${error}`, error);
151+
await replyOrEditReply(interaction, {
152+
content: `Unable to send wiki link: ${error}`,
153+
components: [],
154+
ephemeral: true,
155+
});
156+
}
143157
}
144158
},
145159
};

0 commit comments

Comments
 (0)