Files
discordeno/src/helpers/guilds/guild_splash_url.ts
T
2021-03-23 19:14:26 +04:00

19 lines
492 B
TypeScript

import { Guild } from "../../structures/mod.ts";
import { endpoints } from "../../util/constants.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(
guild: Guild,
size: ImageSize = 128,
format?: ImageFormats,
) {
return guild.splash
? formatImageURL(
endpoints.GUILD_SPLASH(guild.id, guild.splash),
size,
format,
)
: undefined;
}