Skip to content

Commit

Permalink
Yet more better error messages when reacting
Browse files Browse the repository at this point in the history
  • Loading branch information
gausie committed Nov 20, 2023
1 parent eff7adf commit 05e9c85
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/commands/wiki/wiki.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
ChatInputCommandInteraction,
DiscordAPIError,
Events,
Message,
MessageType,
Expand Down Expand Up @@ -87,10 +88,16 @@ async function onMessage(message: Message) {
try {
await message.react("<:kol_mad:516763545657016320>");
} catch (error) {
discordClient.alert("Please give me permissions to react to messages!");
return await message.reply(
if (!(error instanceof DiscordAPIError)) throw error;
if (error.code !== 90001) {
return void (await discordClient.alert(
`Tried to :kol_mad: a poorly-formatted wiki search by ${message.author}; received error ${error}.`,
));
}

return void (await message.reply(
"You blocked me <:kol_mad:516763545657016320>",
);
));
}
const slashCommand = inlineCode(`/wiki ${matches[0][1]}`);
slashNote = `Remember, for this query you could have just run ${slashCommand}\n\n`;
Expand Down

0 comments on commit 05e9c85

Please sign in to comment.