3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-27 11:15:02 +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

@ -1,4 +1,4 @@
import { Awaitable } from "knub/dist/utils";
import { Awaitable } from "./typeUtils";
export async function asyncReduce<T, V>(
arr: T[],

View file

@ -9,8 +9,8 @@ import {
TextBasedChannel,
User,
} from "discord.js";
import { Awaitable } from "knub/dist/utils";
import { MINUTES, noop } from "../utils";
import { Awaitable } from "./typeUtils";
import Timeout = NodeJS.Timeout;
export type LoadPageFn = (page: number) => Awaitable<MessageCreateOptions & MessageEditOptions>;

View file

@ -1,7 +1,9 @@
import { Profiler } from "knub/dist/Profiler";
import type { Knub } from "knub";
import { performance } from "perf_hooks";
import { noop, SECONDS } from "../utils";
type Profiler = Knub["profiler"];
let _profilingEnabled = false;
export const profilingEnabled = () => {

View file

@ -1,7 +1,5 @@
import { GuildPluginData } from "knub";
import { getDefaultPrefix } from "knub/dist/commands/commandUtils";
import { getDefaultMessageCommandPrefix, GuildPluginData } from "knub";
export function getGuildPrefix(pluginData: GuildPluginData<any>) {
// @ts-expect-error: discord.js version mismatch
return pluginData.fullConfig.prefix || getDefaultPrefix(pluginData.client);
return pluginData.fullConfig.prefix || getDefaultMessageCommandPrefix(pluginData.client);
}

View file

@ -9,6 +9,8 @@ export declare type WithRequiredProps<T, K extends keyof T> = T & {
// https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/
export type Awaited<T> = T extends PromiseLike<infer U> ? Awaited<U> : T;
export type Awaitable<T = unknown> = T | Promise<T>;
export type DeepMutable<T> = {
-readonly [P in keyof T]: DeepMutable<T[P]>;
};

View file

@ -7,9 +7,9 @@ import {
MessageComponentInteraction,
MessageCreateOptions,
} from "discord.js";
import { noop } from "knub/dist/utils";
import moment from "moment";
import uuidv4 from "uuid/v4";
import { noop } from "../utils";
export async function waitForButtonConfirm(
channel: GuildTextBasedChannel,
@ -37,6 +37,7 @@ export async function waitForButtonConfirm(
if (options?.restrictToId && options.restrictToId !== interaction.user.id) {
interaction
.reply({ content: `You are not permitted to use these buttons.`, ephemeral: true })
// tslint:disable-next-line no-console
.catch((err) => console.trace(err.message));
} else {
if (interaction.customId.startsWith(`confirmButton:${idMod}:`)) {