CDN

export declare class CDN
export declare class CDN
The CDN link builder
constructor(base?)
Constructs a new instance of the CDN class
NameTypeOptionalDescription
basestringYesNone
appAsset(clientId, assetHash, options?):string
Generates an app asset URL for a client's asset.
NameTypeOptionalDescription
clientIdstringNo
The client id that has the asset
assetHashstringNo
The hash provided by Discord for this asset
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the asset
appIcon(clientId, iconHash, options?):string
Generates an app icon URL for a client's icon.
NameTypeOptionalDescription
clientIdstringNo
The client id that has the icon
iconHashstringNo
The hash provided by Discord for this icon
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the icon
avatar(id, avatarHash, options?):string
Generates an avatar URL, e.g. for a user or a webhook.
NameTypeOptionalDescription
idstringNo
The id that has the icon
avatarHashstringNo
The hash provided by Discord for this avatar
optionsReadonly<ImageURLOptions>Yes
Optional options for the avatar
avatarDecoration(userId, userAvatarDecoration, options?):string
Generates a user avatar decoration URL.
NameTypeOptionalDescription
userIdstringNo
The id of the user
userAvatarDecorationstringNo
The hash provided by Discord for this avatar decoration
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the avatar decoration
Generates a banner URL, e.g. for a user or a guild.
NameTypeOptionalDescription
idstringNo
The id that has the banner splash
bannerHashstringNo
The hash provided by Discord for this banner
optionsReadonly<ImageURLOptions>Yes
Optional options for the banner
channelIcon(channelId, iconHash, options?):string
Generates an icon URL for a channel, e.g. a group DM.
NameTypeOptionalDescription
channelIdstringNo
The channel id that has the icon
iconHashstringNo
The hash provided by Discord for this channel
optionsReadonly<BaseImageURLOptions>Yes
Optional 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
indexnumberNo
The default avatar index
discoverySplash(guildId, splashHash, options?):string
Generates a discovery splash URL for a guild's discovery splash.
NameTypeOptionalDescription
guildIdstringNo
The guild id that has the discovery splash
splashHashstringNo
The hash provided by Discord for this splash
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the splash
emoji(emojiId, options?):string
Generates an emoji's URL for an emoji.
NameTypeOptionalDescription
emojiIdstringNo
The emoji id
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the emoji
guildMemberAvatar(guildId, userId, avatarHash, options?):string
Generates a guild member avatar URL.
NameTypeOptionalDescription
guildIdstringNo
The id of the guild
userIdstringNo
The id of the user
avatarHashstringNo
The hash provided by Discord for this avatar
optionsReadonly<ImageURLOptions>Yes
Optional options for the avatar
guildMemberBanner(guildId, userId, bannerHash, options?):string
Generates a guild member banner URL.
NameTypeOptionalDescription
guildIdstringNo
The id of the guild
userIdstringNo
The id of the user
bannerHashstringNo
The hash provided by Discord for this banner
optionsReadonly<ImageURLOptions>Yes
Optional options for the banner
guildScheduledEventCover(scheduledEventId, coverHash, options?):string
Generates a cover image for a guild scheduled event.
NameTypeOptionalDescription
scheduledEventIdstringNo
The scheduled event id
coverHashstringNo
The hash provided by discord for this cover image
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the cover image
icon(id, iconHash, options?):string
Generates an icon URL, e.g. for a guild.
NameTypeOptionalDescription
idstringNo
The id that has the icon splash
iconHashstringNo
The hash provided by Discord for this icon
optionsReadonly<ImageURLOptions>Yes
Optional options for the icon
roleIcon(roleId, roleIconHash, options?):string
Generates a URL for the icon of a role
NameTypeOptionalDescription
roleIdstringNo
The id of the role that has the icon
roleIconHashstringNo
The hash provided by Discord for this role icon
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the role icon
splash(guildId, splashHash, options?):string
Generates a guild invite splash URL for a guild's invite splash.
NameTypeOptionalDescription
guildIdstringNo
The guild id that has the invite splash
splashHashstringNo
The hash provided by Discord for this splash
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the splash
sticker(stickerId, extension?):string
Generates a sticker URL.
NameTypeOptionalDescription
stickerIdstringNo
The sticker id
extensionStickerExtensionYes
The extension of the sticker
stickerPackBanner(bannerId, options?):string
Generates a sticker pack banner URL.
NameTypeOptionalDescription
bannerIdstringNo
The banner id
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the banner
teamIcon(teamId, iconHash, options?):string
Generates a team icon URL for a team's icon.
NameTypeOptionalDescription
teamIdstringNo
The team id that has the icon
iconHashstringNo
The hash provided by Discord for this icon
optionsReadonly<BaseImageURLOptions>Yes
Optional options for the icon