CDN

export declare class CDN
export declare class CDN
The CDN link builder
constructor(cdn?, mediaProxy?)
Constructs a new instance of the CDN class
NameTypeOptionalDescription
cdnstringYesNone
mediaProxystringYesNone
appAsset(clientId, assetHash, options?):string
Generates an app asset URL for a client's asset.
NameTypeOptionalDescription
clientIdstringNoThe client id that has the asset
assetHashstringNoThe hash provided by Discord for this asset
optionsReadonly<BaseImageURLOptions>YesOptional options for the asset
appIcon(clientId, iconHash, options?):string
Generates an app icon URL for a client's icon.
NameTypeOptionalDescription
clientIdstringNoThe client id that has the icon
iconHashstringNoThe hash provided by Discord for this icon
optionsReadonly<BaseImageURLOptions>YesOptional options for the icon
avatar(id, avatarHash, options?):string
Generates an avatar URL, e.g. for a user or a webhook.
NameTypeOptionalDescription
idstringNoThe id that has the icon
avatarHashstringNoThe hash provided by Discord for this avatar
optionsReadonly<ImageURLOptions>YesOptional options for the avatar
avatarDecoration(asset):string
Generates a user avatar decoration preset URL.
NameTypeOptionalDescription
assetstringNoThe avatar decoration hash
Generates a banner URL, e.g. for a user or a guild.
NameTypeOptionalDescription
idstringNoThe id that has the banner splash
bannerHashstringNoThe hash provided by Discord for this banner
optionsReadonly<ImageURLOptions>YesOptional options for the banner
channelIcon(channelId, iconHash, options?):string
Generates an icon URL for a channel, e.g. a group DM.
NameTypeOptionalDescription
channelIdstringNoThe channel id that has the icon
iconHashstringNoThe hash provided by Discord for this channel
optionsReadonly<BaseImageURLOptions>YesOptional options for the icon
defaultAvatar(index):string
Generates a default avatar URL
Remarks
To calculate the index for a user do (userId >> 22) % 6, or discriminator % 5 if they're using the legacy username system.
NameTypeOptionalDescription
indexnumberNoThe default avatar index
discoverySplash(guildId, splashHash, options?):string
Generates a discovery splash URL for a guild's discovery splash.
NameTypeOptionalDescription
guildIdstringNoThe guild id that has the discovery splash
splashHashstringNoThe hash provided by Discord for this splash
optionsReadonly<BaseImageURLOptions>YesOptional options for the splash
emoji(emojiId, options?):string
Generates an emoji's URL for an emoji.
NameTypeOptionalDescription
emojiIdstringNoThe emoji id
optionsReadonly<BaseImageURLOptions>YesOptional options for the emoji
guildMemberAvatar(guildId, userId, avatarHash, options?):string
Generates a guild member avatar URL.
NameTypeOptionalDescription
guildIdstringNoThe id of the guild
userIdstringNoThe id of the user
avatarHashstringNoThe hash provided by Discord for this avatar
optionsReadonly<ImageURLOptions>YesOptional options for the avatar
guildMemberBanner(guildId, userId, bannerHash, options?):string
Generates a guild member banner URL.
NameTypeOptionalDescription
guildIdstringNoThe id of the guild
userIdstringNoThe id of the user
bannerHashstringNoThe hash provided by Discord for this banner
optionsReadonly<ImageURLOptions>YesOptional options for the banner
guildScheduledEventCover(scheduledEventId, coverHash, options?):string
Generates a cover image for a guild scheduled event.
NameTypeOptionalDescription
scheduledEventIdstringNoThe scheduled event id
coverHashstringNoThe hash provided by discord for this cover image
optionsReadonly<BaseImageURLOptions>YesOptional options for the cover image
icon(id, iconHash, options?):string
Generates an icon URL, e.g. for a guild.
NameTypeOptionalDescription
idstringNoThe id that has the icon splash
iconHashstringNoThe hash provided by Discord for this icon
optionsReadonly<ImageURLOptions>YesOptional options for the icon
roleIcon(roleId, roleIconHash, options?):string
Generates a URL for the icon of a role
NameTypeOptionalDescription
roleIdstringNoThe id of the role that has the icon
roleIconHashstringNoThe hash provided by Discord for this role icon
optionsReadonly<BaseImageURLOptions>YesOptional options for the role icon
splash(guildId, splashHash, options?):string
Generates a guild invite splash URL for a guild's invite splash.
NameTypeOptionalDescription
guildIdstringNoThe guild id that has the invite splash
splashHashstringNoThe hash provided by Discord for this splash
optionsReadonly<BaseImageURLOptions>YesOptional options for the splash
sticker(stickerId, extension?):string
Generates a sticker URL.
NameTypeOptionalDescription
stickerIdstringNoThe sticker id
extensionStickerExtensionYesThe extension of the sticker
stickerPackBanner(bannerId, options?):string
Generates a sticker pack banner URL.
NameTypeOptionalDescription
bannerIdstringNoThe banner id
optionsReadonly<BaseImageURLOptions>YesOptional options for the banner
teamIcon(teamId, iconHash, options?):string
Generates a team icon URL for a team's icon.
NameTypeOptionalDescription
teamIdstringNoThe team id that has the icon
iconHashstringNoThe hash provided by Discord for this icon
optionsReadonly<BaseImageURLOptions>YesOptional options for the icon