mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Type fixes for djs
This commit is contained in:
parent
653d6c1dc2
commit
0822fc15e5
130 changed files with 8877 additions and 411 deletions
|
@ -1,4 +1,4 @@
|
|||
import { MessageEmbedOptions, StageChannel, VoiceChannel } from "discord.js";
|
||||
import { MessageEmbedOptions, Snowflake, StageChannel, VoiceChannel } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
|
@ -21,7 +21,7 @@ export async function getChannelInfoEmbed(
|
|||
channelId: string,
|
||||
requestMemberId?: string,
|
||||
): Promise<MessageEmbedOptions | null> {
|
||||
const channel = pluginData.guild.channels.cache.get(channelId);
|
||||
const channel = pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
if (!channel) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
import { Client, GuildPreview } from "discord.js";
|
||||
import { Client, GuildPreview, Snowflake } from "discord.js";
|
||||
import { memoize, MINUTES } from "../../../utils";
|
||||
|
||||
/**
|
||||
* Memoized getGuildPreview
|
||||
*/
|
||||
export function getGuildPreview(client: Client, guildId: string): Promise<GuildPreview | null> {
|
||||
return memoize(() => client.fetchGuildPreview(guildId).catch(() => null), `getGuildPreview_${guildId}`, 10 * MINUTES);
|
||||
return memoize(
|
||||
() => client.fetchGuildPreview(guildId as Snowflake).catch(() => null),
|
||||
`getGuildPreview_${guildId}`,
|
||||
10 * MINUTES,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { MessageEmbedOptions, TextChannel } from "discord.js";
|
||||
import { MessageEmbedOptions, Snowflake, TextChannel } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { getDefaultPrefix } from "knub/dist/commands/commandUtils";
|
||||
|
@ -16,8 +16,8 @@ export async function getMessageInfoEmbed(
|
|||
messageId: string,
|
||||
requestMemberId?: string,
|
||||
): Promise<MessageEmbedOptions | null> {
|
||||
const message = await (pluginData.guild.channels.resolve(channelId) as TextChannel).messages
|
||||
.fetch(messageId)
|
||||
const message = await (pluginData.guild.channels.resolve(channelId as Snowflake) as TextChannel).messages
|
||||
.fetch(messageId as Snowflake)
|
||||
.catch(() => null);
|
||||
if (!message) {
|
||||
return null;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { CategoryChannel, MessageEmbedOptions, TextChannel, VoiceChannel } from "discord.js";
|
||||
import { CategoryChannel, MessageEmbedOptions, Snowflake, TextChannel, VoiceChannel } from "discord.js";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { GuildPluginData } from "knub";
|
||||
import moment from "moment-timezone";
|
||||
|
@ -25,7 +25,7 @@ export async function getServerInfoEmbed(
|
|||
const thisServer = serverId === pluginData.guild.id ? pluginData.guild : null;
|
||||
const [restGuild, guildPreview] = await Promise.all([
|
||||
thisServer
|
||||
? memoize(() => pluginData.client.guilds.fetch(serverId), `getRESTGuild_${serverId}`, 10 * MINUTES)
|
||||
? memoize(() => pluginData.client.guilds.fetch(serverId as Snowflake), `getRESTGuild_${serverId}`, 10 * MINUTES)
|
||||
: null,
|
||||
getGuildPreview(pluginData.client, serverId),
|
||||
]);
|
||||
|
@ -68,7 +68,7 @@ export async function getServerInfoEmbed(
|
|||
const ownerName = `${owner.username}#${owner.discriminator}`;
|
||||
|
||||
basicInformation.push(`Owner: **${ownerName}** (\`${thisServer.ownerID}\`)`);
|
||||
basicInformation.push(`Voice region: **${thisServer.region}**`);
|
||||
// basicInformation.push(`Voice region: **${thisServer.region}**`); Outdated, as automatic voice regions are fully live
|
||||
}
|
||||
|
||||
if (features.length > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue