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:
parent
e48ca5c075
commit
7c5e6eb91f
18 changed files with 51 additions and 45 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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> = {},
|
||||
|
|
|
@ -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() !== "";
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue