Change DiscordRESTError to DiscordAPIError
This commit is contained in:
parent
be71357ff9
commit
1ad70ffe1a
18 changed files with 50 additions and 50 deletions
|
@ -1,7 +1,7 @@
|
|||
import { Message, Snowflake } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { isDiscordRESTError } from "../../../utils";
|
||||
import { isDiscordAPIError } from "../../../utils";
|
||||
import { reactionRolesCmd } from "../types";
|
||||
|
||||
export const ClearReactionRolesCmd = reactionRolesCmd({
|
||||
|
@ -25,7 +25,7 @@ export const ClearReactionRolesCmd = reactionRolesCmd({
|
|||
try {
|
||||
targetMessage = await args.message.channel.messages.fetch(args.message.messageId as Snowflake);
|
||||
} catch (err) {
|
||||
if (isDiscordRESTError(err) && err.code === 50001) {
|
||||
if (isDiscordAPIError(err) && err.code === 50001) {
|
||||
sendErrorMessage(pluginData, msg.channel, "Missing access to the specified message");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Snowflake } from "discord.js";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { canUseEmoji, isDiscordRESTError, isValidEmoji, noop, trimPluginDescription } from "../../../utils";
|
||||
import { canUseEmoji, isDiscordAPIError, isValidEmoji, noop, trimPluginDescription } from "../../../utils";
|
||||
import { canReadChannel } from "../../../utils/canReadChannel";
|
||||
import { reactionRolesCmd, TReactionRolePair } from "../types";
|
||||
import { applyReactionRoleReactionsToMessage } from "../util/applyReactionRoleReactionsToMessage";
|
||||
|
@ -42,7 +42,7 @@ export const InitReactionRolesCmd = reactionRolesCmd({
|
|||
try {
|
||||
targetMessage = await args.message.channel.messages.fetch(args.message.messageId as Snowflake).catch(noop);
|
||||
} catch (e) {
|
||||
if (isDiscordRESTError(e)) {
|
||||
if (isDiscordAPIError(e)) {
|
||||
sendErrorMessage(pluginData, msg.channel, `Error ${e.code} while getting message: ${e.message}`);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue