Files
discordeno/helpers/guilds/guildIconUrl.ts
ITOH 1edb3c2110 refactor(bot,plugins/helpers,rest,util)!: improve rest route handling (#2248)
* refactor(bot,helpers,plugins,rest,util)!: improve rest route handling
 - rename endpoints constant to routes
 - simplify routes code by removing bases and function calls
 - url query params can now be passed to the route functions

* style: deno fmt

* fix base stuff

* suggestions
2022-05-25 20:35:25 +02: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;
}