3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-14 22:05:01 +00:00

Change DiscordRESTError to DiscordAPIError

This commit is contained in:
Dark 2021-06-30 23:06:02 +02:00
parent be71357ff9
commit 1ad70ffe1a
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
18 changed files with 50 additions and 50 deletions

View file

@ -1,6 +1,6 @@
import { MessagePayload, User } from "discord.js";
import { logger } from "../logger";
import { createChunkedMessage, HOURS, isDiscordRESTError } from "../utils";
import { createChunkedMessage, HOURS, isDiscordAPIError } from "../utils";
import Timeout = NodeJS.Timeout;
let dmsDisabled = false;
@ -30,7 +30,7 @@ export async function sendDM(user: User, content: string | MessagePayload, sourc
await user.send(content);
}
} catch (e) {
if (isDiscordRESTError(e) && e.code === 20026) {
if (isDiscordAPIError(e) && e.code === 20026) {
logger.warn(`Received error code 20026: ${e.message}`);
logger.warn("Disabling attempts to send DMs for 1 hour");
disableDMs(1 * HOURS);