Class CDN

The CDN link builder

Hierarchy

  • CDN

Constructors

  • Parameters

    • Optional cdn: string
    • Optional mediaProxy: string

    Returns CDN

Properties

cdn: any
dynamicMakeURL: any

Constructs the URL for the resource, checking whether or not hash starts with a_ if dynamic is set to true.

Param

The base cdn route

Param

The hash provided by Discord for this icon

Param

Optional options for the link

makeURL: any

Constructs the URL for the resource

Param

The base cdn route

Param

The extension/size options for the link

mediaProxy: any

Methods

  • Generates an app asset URL for a client's asset.

    Parameters

    • clientId: string

      The client id that has the asset

    • assetHash: string

      The hash provided by Discord for this asset

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the asset

    Returns string

  • Generates an app icon URL for a client's icon.

    Parameters

    • clientId: string

      The client id that has the icon

    • iconHash: string

      The hash provided by Discord for this icon

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the icon

    Returns string

  • Generates an avatar URL, e.g. for a user or a webhook.

    Parameters

    • id: string

      The id that has the icon

    • avatarHash: string

      The hash provided by Discord for this avatar

    • Optional options: Readonly<ImageURLOptions>

      Optional options for the avatar

    Returns string

  • Generates a user avatar decoration preset URL.

    Parameters

    • asset: string

      The avatar decoration hash

    Returns string

  • Generates a user avatar decoration URL.

    Parameters

    • userId: string

      The id of the user

    • userAvatarDecoration: string

      The hash provided by Discord for this avatar decoration

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the avatar decoration

    Returns string

    Deprecated

    This overload is deprecated. Pass a hash instead.

  • Generates a banner URL, e.g. for a user or a guild.

    Parameters

    • id: string

      The id that has the banner splash

    • bannerHash: string

      The hash provided by Discord for this banner

    • Optional options: Readonly<ImageURLOptions>

      Optional options for the banner

    Returns string

  • Generates an icon URL for a channel, e.g. a group DM.

    Parameters

    • channelId: string

      The channel id that has the icon

    • iconHash: string

      The hash provided by Discord for this channel

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the icon

    Returns string

  • Generates a default avatar URL

    Parameters

    • index: number

      The default avatar index

    Returns string

    Remarks

    To calculate the index for a user do (userId >> 22) % 6, or discriminator % 5 if they're using the legacy username system.

  • Generates a discovery splash URL for a guild's discovery splash.

    Parameters

    • guildId: string

      The guild id that has the discovery splash

    • splashHash: string

      The hash provided by Discord for this splash

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the splash

    Returns string

  • Generates an emoji's URL for an emoji.

    Parameters

    • emojiId: string

      The emoji id

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the emoji

    Returns string

  • Generates an emoji's URL for an emoji.

    Parameters

    • emojiId: string

      The emoji id

    • Optional extension: "webp" | "png" | "jpg" | "jpeg" | "gif"

      The extension of the emoji

    Returns string

    Deprecated

    This overload is deprecated. Pass an object containing the extension instead.

  • Generates a guild member avatar URL.

    Parameters

    • guildId: string

      The id of the guild

    • userId: string

      The id of the user

    • avatarHash: string

      The hash provided by Discord for this avatar

    • Optional options: Readonly<ImageURLOptions>

      Optional options for the avatar

    Returns string

  • Generates a guild member banner URL.

    Parameters

    • guildId: string

      The id of the guild

    • userId: string

      The id of the user

    • bannerHash: string

      The hash provided by Discord for this banner

    • Optional options: Readonly<ImageURLOptions>

      Optional options for the banner

    Returns string

  • Generates a cover image for a guild scheduled event.

    Parameters

    • scheduledEventId: string

      The scheduled event id

    • coverHash: string

      The hash provided by discord for this cover image

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the cover image

    Returns string

  • Generates an icon URL, e.g. for a guild.

    Parameters

    • id: string

      The id that has the icon splash

    • iconHash: string

      The hash provided by Discord for this icon

    • Optional options: Readonly<ImageURLOptions>

      Optional options for the icon

    Returns string

  • Generates a URL for the icon of a role

    Parameters

    • roleId: string

      The id of the role that has the icon

    • roleIconHash: string

      The hash provided by Discord for this role icon

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the role icon

    Returns string

  • Generates a guild invite splash URL for a guild's invite splash.

    Parameters

    • guildId: string

      The guild id that has the invite splash

    • splashHash: string

      The hash provided by Discord for this splash

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the splash

    Returns string

  • Generates a sticker URL.

    Parameters

    • stickerId: string

      The sticker id

    • Optional extension: "json" | "png" | "gif"

      The extension of the sticker

    Returns string

  • Generates a sticker pack banner URL.

    Parameters

    • bannerId: string

      The banner id

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the banner

    Returns string

  • Generates a team icon URL for a team's icon.

    Parameters

    • teamId: string

      The team id that has the icon

    • iconHash: string

      The hash provided by Discord for this icon

    • Optional options: Readonly<BaseImageURLOptions>

      Optional options for the icon

    Returns string

Generated using TypeDoc