Files
discordeno/helpers/guilds/guildIconUrl.ts
ITOH 03996c5f58 refactor: revert "feat: base plugin lib idea (#2308)" (#2336)
* Revert "feat: base plugin lib idea (#2308)"

This reverts commit ffe7cdbc6f.

* fmt
2022-07-02 14:24:43 +01:00

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;
}