3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-11 13:07:20 +00:00

feat: knub v32-next; related fixes

This commit is contained in:
Dragory 2023-04-01 02:16:15 +03:00
parent 448293d6ac
commit c36d47e0b8
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
89 changed files with 287 additions and 931 deletions

View file

@ -2,21 +2,14 @@ import {
Client,
Events,
GatewayIntentBits,
GuildTextBasedChannel,
Message,
Options,
Partials,
RESTEvents,
TextBasedChannel,
TextChannel,
ThreadChannel,
} from "discord.js";
import { Knub, PluginError } from "knub";
import { PluginLoadError } from "knub/dist/plugins/PluginLoadError";
// Always use UTC internally
// This is also enforced for the database in data/db.ts
import { EventEmitter } from "events";
import { PluginNotLoadedError } from "knub/dist/plugins/PluginNotLoadedError";
import { Knub, PluginError, PluginLoadError, PluginNotLoadedError } from "knub";
import moment from "moment-timezone";
import { performance } from "perf_hooks";
import { AllowedGuilds } from "./data/AllowedGuilds";
@ -48,18 +41,6 @@ import { DecayingCounter } from "./utils/DecayingCounter";
import { enableProfiling } from "./utils/easyProfiler";
import { loadYamlSafely } from "./utils/loadYamlSafely";
// TODO: Remove this once fixed on upstream
declare module "knub/dist/helpers" {
export function waitForReply(
client: Client,
channel: GuildTextBasedChannel,
restrictToUserId?: string,
timeout?: number,
): Promise<Message | null>;
export function createChunkedMessage(channel: TextBasedChannel, messageText: string): Promise<Message[]>;
}
// Error handling
let recentPluginErrors = 0;
const RECENT_PLUGIN_ERROR_EXIT_THRESHOLD = 5;
@ -184,6 +165,8 @@ for (const [i, part] of actualVersionParts.entries()) {
throw new SimpleError(`Unsupported Node.js version! Must be at least ${REQUIRED_NODE_VERSION}`);
}
// Always use UTC internally
// This is also enforced for the database in data/db.ts
moment.tz.setDefault("UTC");
// Blocking check