3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

chore: update to discord.js 13.7.0

This commit is contained in:
Dragory 2022-06-01 19:26:43 +03:00
parent 6df67da3cb
commit 5387d4a82a
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
4 changed files with 135 additions and 76 deletions

View file

@ -1,4 +1,11 @@
import { Message, MessageOptions, NewsChannel, TextChannel, WebhookClient } from "discord.js";
import {
Message,
MessageEditOptions,
NewsChannel,
TextChannel,
WebhookClient,
WebhookEditMessageOptions,
} from "discord.js";
import { GuildPluginData } from "knub";
import { InternalPosterPluginType } from "../types";
import { isDiscordAPIError, noop } from "../../../utils";
@ -9,7 +16,7 @@ import { isDiscordAPIError, noop } from "../../../utils";
export async function editMessage(
pluginData: GuildPluginData<InternalPosterPluginType>,
message: Message,
content: MessageOptions,
content: MessageEditOptions & WebhookEditMessageOptions,
): Promise<void> {
if (!(message.channel instanceof TextChannel || message.channel instanceof NewsChannel)) {
return;

View file

@ -70,13 +70,13 @@ export async function getChannelInfoEmbed(
channelName = channel.name;
}
const createdAt = moment.utc(channel.createdAt, "x");
const createdAt = moment.utc(channel.createdAt!, "x");
const timeAndDate = pluginData.getPlugin(TimeAndDatePlugin);
const tzCreatedAt = requestMemberId
? await timeAndDate.inMemberTz(requestMemberId, createdAt)
: timeAndDate.inGuildTz(createdAt);
const prettyCreatedAt = tzCreatedAt.format(timeAndDate.getDateFormat("pretty_datetime"));
const channelAge = humanizeDuration(Date.now() - channel.createdTimestamp, {
const channelAge = humanizeDuration(Date.now() - channel.createdTimestamp!, {
largest: 2,
round: true,
});
@ -134,8 +134,9 @@ export async function getChannelInfoEmbed(
const memberCount = thread.memberCount ?? thread.members.cache.size;
const owner = await thread.fetchOwner().catch(() => null);
const ownerMention = owner?.user ? verboseUserMention(owner.user) : "Unknown#0000";
const autoArchiveDuration = thread.autoArchiveDuration === "MAX" ? 10080 : thread.autoArchiveDuration; // TODO: Boost level check
const humanizedArchiveTime = `Archive duration: **${humanizeDuration((autoArchiveDuration ?? 0) * MINUTES)}**`;
const humanizedArchiveTime = `Archive duration: **${humanizeDuration(
(thread.autoArchiveDuration ?? 0) * MINUTES,
)}**`;
embed.fields.push({
name: preEmbedPadding + "Thread information",