fix: guildSplashURL no longer accepts cached guild

This commit is contained in:
Skillz4Killz
2021-04-04 12:21:15 +00:00
committed by GitHub
parent fbfd3455b5
commit 8f4dd71973
+8 -6
View File
@@ -1,16 +1,18 @@
import { Guild } from "../../structures/mod.ts"; import { DiscordImageFormat } from "../../types/misc/image_format.ts";
import { DiscordImageSize } from "../../types/misc/image_size.ts";
import { endpoints } from "../../util/constants.ts"; import { endpoints } from "../../util/constants.ts";
import { formatImageURL } from "../../util/utils.ts"; import { formatImageURL } from "../../util/utils.ts";
/** The full URL of the splash from Discords CDN. Undefined if no splash is set. */ /** The full URL of the splash from Discords CDN. Undefined if no splash is set. */
export function guildSplashURL( export function guildSplashURL(
guild: Guild, id: string,
size: ImageSize = 128, splash: string,
format?: ImageFormats, size: DiscordImageSize = 128,
format?: DiscordImageFormat,
) { ) {
return guild.splash return splash
? formatImageURL( ? formatImageURL(
endpoints.GUILD_SPLASH(guild.id, guild.splash), endpoints.GUILD_SPLASH(id, splash),
size, size,
format, format,
) )