mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
25 lines
603 B
TypeScript
25 lines
603 B
TypeScript
import type { Bot } from "../../bot.ts";
|
|
import { ImageFormat, ImageSize } from "../members/avatarUrl.ts";
|
|
|
|
/** The full URL of the icon from Discords CDN. Undefined when no icon is set. */
|
|
export function guildIconURL(
|
|
bot: Bot,
|
|
id: bigint,
|
|
icon: bigint | undefined,
|
|
options?: {
|
|
size?: ImageSize;
|
|
format?: ImageFormat;
|
|
},
|
|
) {
|
|
return icon
|
|
? bot.utils.formatImageURL(
|
|
bot.constants.routes.GUILD_ICON(
|
|
id,
|
|
typeof icon === "string" ? icon : bot.utils.iconBigintToHash(icon),
|
|
),
|
|
options?.size || 128,
|
|
options?.format,
|
|
)
|
|
: undefined;
|
|
}
|