mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
convert hashes to big ints + bools
This commit is contained in:
@@ -1,20 +1,30 @@
|
||||
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";
|
||||
|
||||
/** The full URL of the splash from Discords CDN. Undefined if no splash is set. */
|
||||
export function guildSplashURL(
|
||||
id: bigint,
|
||||
splash?: string,
|
||||
size: DiscordImageSize = 128,
|
||||
format?: DiscordImageFormat,
|
||||
options: {
|
||||
splash?: string | bigint;
|
||||
size?: DiscordImageSize;
|
||||
format?: DiscordImageFormat;
|
||||
animated?: boolean;
|
||||
},
|
||||
) {
|
||||
return splash
|
||||
return options.splash
|
||||
? formatImageURL(
|
||||
endpoints.GUILD_SPLASH(id, splash),
|
||||
size,
|
||||
format,
|
||||
endpoints.GUILD_SPLASH(
|
||||
id,
|
||||
typeof options.splash === "string" ? options.splash : iconBigintToHash(
|
||||
options.splash,
|
||||
options.animated ?? true,
|
||||
),
|
||||
),
|
||||
options.size || 128,
|
||||
options.format,
|
||||
)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user