Guilds helpers

This commit is contained in:
TriForMine
2021-10-21 19:38:09 +02:00
parent baf8583976
commit 20616e8a36
29 changed files with 156 additions and 167 deletions
+5 -6
View File
@@ -1,11 +1,10 @@
import type { DiscordImageFormat } from "../../types/misc/image_format.ts";
import type { DiscordImageSize } from "../../types/misc/image_size.ts";
import { endpoints } from "../../util/constants.ts";
import { iconBigintToHash } from "../../util/hash.ts";
import { formatImageURL } from "../../util/utils.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;
@@ -15,12 +14,12 @@ export function guildSplashURL(
}
) {
return options.splash
? formatImageURL(
endpoints.GUILD_SPLASH(
? bot.utils.formatImageURL(
bot.constants.endpoints.GUILD_SPLASH(
id,
typeof options.splash === "string"
? options.splash
: iconBigintToHash(options.splash, options.animated ?? true)
: bot.utils.iconBigintToHash(options.splash, options.animated ?? true)
),
options.size || 128,
options.format