Skip to content

Commit

Permalink
use instanceof type guard
Browse files Browse the repository at this point in the history
  • Loading branch information
horrible-little-slime committed Nov 16, 2023
1 parent 2a9acfd commit 5e9c5ab
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/commands/misc/itom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Events, Message } from "discord.js";
import { DiscordAPIError, Events, Message } from "discord.js";

import { discordClient } from "../../clients/discord.js";

Expand All @@ -14,14 +14,13 @@ async function onMessage(message: Message) {
try {
await message.react("<:minusone:748016030357520464>");
} catch (error) {
const stringedError = `${error}`;
if (stringedError.includes("Reaction blocked")) {
await message.member?.kick("You mess with the bot, you get the boot");
} else {
discordClient.alert(
if (!(error instanceof DiscordAPIError)) throw error;
if (error.code !== 90001) {
return void (await discordClient.alert(
`Tried to :minusone: a message containing the forbidden string by ${message.author}; received error ${error}.`,
);
));
}
await message.member?.kick("You mess with the oaf, you get the boot");
}
}
}
Expand Down

0 comments on commit 5e9c5ab

Please sign in to comment.