export declare class CDN
export declare class CDN
The CDN link builder
constructor(base?)
Constructs a new instance of the
CDN
className | Type | Optional | Description |
---|---|---|---|
base | string | Yes | None |
appAsset(clientId, assetHash, options?)
:
string
Generates an app asset URL for a client's asset.
Name | Type | Optional | Description |
---|---|---|---|
clientId | string | No | The client id that has the asset |
assetHash | string | No | The hash provided by Discord for this asset |
options | Readonly<BaseImageURLOptions> | Yes | Optional options for the asset |
appIcon(clientId, iconHash, options?)
:
string
Generates an app icon URL for a client's icon.
Name | Type | Optional | Description |
---|---|---|---|
clientId | string | No | The client id that has the icon |
iconHash | string | No | The hash provided by Discord for this icon |
options | Readonly<BaseImageURLOptions> | Yes | Optional options for the icon |
avatar(id, avatarHash, options?)
:
string
Generates an avatar URL, e.g. for a user or a webhook.
Name | Type | Optional | Description |
---|---|---|---|
id | string | No | The id that has the icon |
avatarHash | string | No | The hash provided by Discord for this avatar |
options | Readonly<ImageURLOptions> | Yes | Optional options for the avatar |
avatarDecoration(userId, userAvatarDecoration, options?)
:
string
Generates a user avatar decoration URL.
Name | Type | Optional | Description |
---|---|---|---|
userId | string | No | The id of the user |
userAvatarDecoration | string | No | The hash provided by Discord for this avatar decoration |
options | Readonly<BaseImageURLOptions> | Yes | Optional options for the avatar decoration |
banner(id, bannerHash, options?)
:
string
Generates a banner URL, e.g. for a user or a guild.
Name | Type | Optional | Description |
---|---|---|---|
id | string | No | The id that has the banner splash |
bannerHash | string | No | The hash provided by Discord for this banner |
options | Readonly<ImageURLOptions> | Yes | Optional options for the banner |
channelIcon(channelId, iconHash, options?)
:
string
Generates an icon URL for a channel, e.g. a group DM.
Name | Type | Optional | Description |
---|---|---|---|
channelId | string | No | The channel id that has the icon |
iconHash | string | No | The hash provided by Discord for this channel |
options | Readonly<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.Name | Type | Optional | Description |
---|---|---|---|
index | number | No | The default avatar index |
discoverySplash(guildId, splashHash, options?)
:
string
Generates a discovery splash URL for a guild's discovery splash.
Name | Type | Optional | Description |
---|---|---|---|
guildId | string | No | The guild id that has the discovery splash |
splashHash | string | No | The hash provided by Discord for this splash |
options | Readonly<BaseImageURLOptions> | Yes | Optional options for the splash |
emoji(emojiId, extension?)
:
string
Generates an emoji's URL for an emoji.
Name | Type | Optional | Description |
---|---|---|---|
emojiId | string | No | The emoji id |
extension | ImageExtension | Yes | The extension of the emoji |
guildMemberAvatar(guildId, userId, avatarHash, options?)
:
string
Generates a guild member avatar URL.
Name | Type | Optional | Description |
---|---|---|---|
guildId | string | No | The id of the guild |
userId | string | No | The id of the user |
avatarHash | string | No | The hash provided by Discord for this avatar |
options | Readonly<ImageURLOptions> | Yes | Optional options for the avatar |
guildMemberBanner(guildId, userId, bannerHash, options?)
:
string
Generates a guild member banner URL.
Name | Type | Optional | Description |
---|---|---|---|
guildId | string | No | The id of the guild |
userId | string | No | The id of the user |
bannerHash | string | No | The hash provided by Discord for this banner |
options | Readonly<ImageURLOptions> | Yes | Optional options for the banner |
guildScheduledEventCover(scheduledEventId, coverHash, options?)
:
string
Generates a cover image for a guild scheduled event.
Name | Type | Optional | Description |
---|---|---|---|
scheduledEventId | string | No | The scheduled event id |
coverHash | string | No | The hash provided by discord for this cover image |
options | Readonly<BaseImageURLOptions> | Yes | Optional options for the cover image |
icon(id, iconHash, options?)
:
string
Generates an icon URL, e.g. for a guild.
Name | Type | Optional | Description |
---|---|---|---|
id | string | No | The id that has the icon splash |
iconHash | string | No | The hash provided by Discord for this icon |
options | Readonly<ImageURLOptions> | Yes | Optional options for the icon |
roleIcon(roleId, roleIconHash, options?)
:
string
Generates a URL for the icon of a role
Name | Type | Optional | Description |
---|---|---|---|
roleId | string | No | The id of the role that has the icon |
roleIconHash | string | No | The hash provided by Discord for this role icon |
options | Readonly<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.
Name | Type | Optional | Description |
---|---|---|---|
guildId | string | No | The guild id that has the invite splash |
splashHash | string | No | The hash provided by Discord for this splash |
options | Readonly<BaseImageURLOptions> | Yes | Optional options for the splash |
sticker(stickerId, extension?)
:
string
Generates a sticker URL.
Name | Type | Optional | Description |
---|---|---|---|
stickerId | string | No | The sticker id |
extension | StickerExtension | Yes | The extension of the sticker |
stickerPackBanner(bannerId, options?)
:
string
Generates a sticker pack banner URL.
Name | Type | Optional | Description |
---|---|---|---|
bannerId | string | No | The banner id |
options | Readonly<BaseImageURLOptions> | Yes | Optional options for the banner |
teamIcon(teamId, iconHash, options?)
:
string
Generates a team icon URL for a team's icon.
Name | Type | Optional | Description |
---|---|---|---|
teamId | string | No | The team id that has the icon |
iconHash | string | No | The hash provided by Discord for this icon |
options | Readonly<BaseImageURLOptions> | Yes | Optional options for the icon |