mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Change DiscordRESTError to DiscordAPIError
This commit is contained in:
parent
be71357ff9
commit
1ad70ffe1a
18 changed files with 50 additions and 50 deletions
|
@ -4,7 +4,7 @@ import { GuildPluginData } from "knub";
|
|||
import { logger } from "../../../logger";
|
||||
import { hasPermission, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError";
|
||||
import { asSingleLine, isDiscordRESTError, UnknownUser } from "../../../utils";
|
||||
import { asSingleLine, isDiscordAPIError, UnknownUser } from "../../../utils";
|
||||
import { MutesPlugin } from "../../Mutes/MutesPlugin";
|
||||
import { MuteResult } from "../../Mutes/types";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
|
@ -60,7 +60,7 @@ export async function actualMuteUserCmd(
|
|||
} catch (e) {
|
||||
if (e instanceof RecoverablePluginError && e.code === ERRORS.NO_MUTE_ROLE_IN_CONFIG) {
|
||||
sendErrorMessage(pluginData, msg.channel as TextChannel, "Could not mute the user: no mute role set in config");
|
||||
} else if (isDiscordRESTError(e) && e.code === 10007) {
|
||||
} else if (isDiscordAPIError(e) && e.code === 10007) {
|
||||
sendErrorMessage(pluginData, msg.channel as TextChannel, "Could not mute the user: unknown member");
|
||||
} else {
|
||||
logger.error(`Failed to mute user ${user.id}: ${e.stack}`);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Permissions, Snowflake } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { isDiscordHTTPError, isDiscordRESTError, SECONDS, sleep } from "../../../utils";
|
||||
import { isDiscordHTTPError, isDiscordAPIError, SECONDS, sleep } from "../../../utils";
|
||||
import { hasDiscordPermissions } from "../../../utils/hasDiscordPermissions";
|
||||
import { LogsPlugin } from "../../Logs/LogsPlugin";
|
||||
import { ModActionsPluginType } from "../types";
|
||||
|
@ -26,7 +26,7 @@ export async function isBanned(
|
|||
]);
|
||||
return potentialBan != null;
|
||||
} catch (e) {
|
||||
if (isDiscordRESTError(e) && e.code === 10026) {
|
||||
if (isDiscordAPIError(e) && e.code === 10026) {
|
||||
// [10026]: Unknown Ban
|
||||
return false;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ export async function isBanned(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isDiscordRESTError(e) && e.code === 50013) {
|
||||
if (isDiscordAPIError(e) && e.code === 50013) {
|
||||
pluginData.getPlugin(LogsPlugin).log(LogType.BOT_ALERT, {
|
||||
body: `Missing "Ban Members" permission to check for existing bans`,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue