mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Add new multi-use !info command
This commit is contained in:
parent
7ad2458fd9
commit
106a959b4d
7 changed files with 184 additions and 61 deletions
9
backend/src/plugins/Utility/functions/getGuildPreview.ts
Normal file
9
backend/src/plugins/Utility/functions/getGuildPreview.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { Client, GuildPreview } from "eris";
|
||||
import { memoize, MINUTES } from "../../../utils";
|
||||
|
||||
/**
|
||||
* Memoized getGuildPreview
|
||||
*/
|
||||
export function getGuildPreview(client: Client, guildId: string): Promise<GuildPreview | null> {
|
||||
return memoize(() => client.getGuildPreview(guildId).catch(() => null), `getGuildPreview_${guildId}`, 10 * MINUTES);
|
||||
}
|
|
@ -4,6 +4,7 @@ import { embedPadding, formatNumber, memoize, MINUTES, preEmbedPadding, resolveU
|
|||
import { CategoryChannel, EmbedOptions, Guild, RESTChannelInvite, TextChannel, VoiceChannel } from "eris";
|
||||
import moment from "moment-timezone";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
import { getGuildPreview } from "./getGuildPreview";
|
||||
|
||||
export async function getServerInfoEmbed(
|
||||
pluginData: PluginData<UtilityPluginType>,
|
||||
|
@ -14,11 +15,7 @@ export async function getServerInfoEmbed(
|
|||
thisServer
|
||||
? memoize(() => pluginData.client.getRESTGuild(serverId), `getRESTGuild_${serverId}`, 10 * MINUTES)
|
||||
: null,
|
||||
memoize(
|
||||
() => pluginData.client.getGuildPreview(serverId).catch(() => null),
|
||||
`getGuildPreview_${serverId}`,
|
||||
10 * MINUTES,
|
||||
),
|
||||
getGuildPreview(pluginData.client, serverId),
|
||||
]);
|
||||
|
||||
if (!restGuild && !guildPreview) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue