3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-27 11:15:02 +00:00

more fixes

Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
metal 2023-03-11 15:13:49 +00:00 committed by GitHub
parent e48ca5c075
commit 7c5e6eb91f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 51 additions and 45 deletions

View file

@ -1,4 +1,4 @@
import { MessageEmbedOptions } from "discord.js";
import { EmbedData } from "discord.js";
function sumStringLengthsRecursively(obj: any): number {
if (obj == null) return 0;
@ -12,6 +12,6 @@ function sumStringLengthsRecursively(obj: any): number {
return 0;
}
export function calculateEmbedSize(embed: MessageEmbedOptions): number {
export function calculateEmbedSize(embed: EmbedData): number {
return sumStringLengthsRecursively(embed);
}

View file

@ -1,11 +1,13 @@
import {
Client,
GuildTextBasedChannel,
Message,
MessageCreateOptions,
MessageEditOptions,
MessageOptions,
MessageReaction,
PartialMessageReaction,
PartialUser,
TextBasedChannel,
TextChannel,
User,
} from "discord.js";
@ -13,7 +15,7 @@ import { Awaitable } from "knub/dist/utils";
import { MINUTES, noop } from "../utils";
import Timeout = NodeJS.Timeout;
export type LoadPageFn = (page: number) => Awaitable<MessageOptions & MessageEditOptions>;
export type LoadPageFn = (page: number) => Awaitable<MessageCreateOptions & MessageEditOptions>;
export interface PaginateMessageOpts {
timeout: number;
@ -27,7 +29,7 @@ const defaultOpts: PaginateMessageOpts = {
export async function createPaginatedMessage(
client: Client,
channel: TextChannel | User,
channel: TextBasedChannel | User,
totalPages: number,
loadPageFn: LoadPageFn,
opts: Partial<PaginateMessageOpts> = {},

View file

@ -1,4 +1,5 @@
import { MessageOptions } from "discord.js";
import { MessageOptions } from "child_process";
import { MessageCreateOptions, MessagePayload } from "discord.js";
function embedHasContent(embed: any) {
for (const [key, value] of Object.entries(embed)) {
@ -18,7 +19,7 @@ function embedHasContent(embed: any) {
return false;
}
export function messageHasContent(content: string | MessageOptions): boolean {
export function messageHasContent(content: string | MessageCreateOptions): boolean {
if (typeof content === "string") {
return content.trim() !== "";
}

View file

@ -1,6 +1,6 @@
import { MessageOptions } from "discord.js";
import { MessageCreateOptions } from "discord.js";
import { messageHasContent } from "./messageHasContent";
export function messageIsEmpty(content: string | MessageOptions): boolean {
export function messageIsEmpty(content: string | MessageCreateOptions): boolean {
return !messageHasContent(content);
}