mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
29 lines
834 B
TypeScript
29 lines
834 B
TypeScript
import type { DiscordImageFormat } from "../../types/misc/image_format.ts";
|
|
import type { DiscordImageSize } from "../../types/misc/image_size.ts";
|
|
import type { Bot } from "../../bot.ts";
|
|
|
|
/** The full URL of the splash from Discords CDN. Undefined if no splash is set. */
|
|
export function guildSplashURL(
|
|
bot: Bot,
|
|
id: bigint,
|
|
options: {
|
|
splash?: string | bigint;
|
|
size?: DiscordImageSize;
|
|
format?: DiscordImageFormat;
|
|
animated?: boolean;
|
|
}
|
|
) {
|
|
return options.splash
|
|
? bot.utils.formatImageURL(
|
|
bot.constants.endpoints.GUILD_SPLASH(
|
|
id,
|
|
typeof options.splash === "string"
|
|
? options.splash
|
|
: bot.utils.iconBigintToHash(options.splash, options.animated ?? true)
|
|
),
|
|
options.size || 128,
|
|
options.format
|
|
)
|
|
: undefined;
|
|
}
|