Class Webhook

Represents a webhook.

Hierarchy

Constructors

Properties

application?: null | ClientApplication

The application associated with this webhook.

applicationID: null | string

The ID of the application associated with this webhook.

avatar: null | string

The hash of this webhook's avatar.

channelID: null | string

The ID of the channel this webhook is for, if applicable.

guildID: null | string

The id of the guild this webhook is in, if applicable.

id: string
name: null | string

The username of this webhook, if any.

sourceChannel?: Pick<RawChannel, "name" | "id">

The source channel for this webhook (channel follower only).

sourceGuild?: Pick<RawGuild, "name" | "icon" | "id">

The source guild for this webhook (channel follower only).

token?: string

The token for this webhook (not present for webhooks created by other applications)

The type of this webhook.

user: null | User

The user that created this webhook.

Accessors

Methods

  • The url of this webhook's avatar.

    Parameters

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

      The format the url should be.

    • Optional size: number

      The dimensions of the image.

    Returns null | string

  • Delete this webhook (requires a bot user, see deleteToken).

    Parameters

    • Optional reason: string

      The reason for deleting this webhook.

    Returns Promise<void>

  • Delete this webhook via its token.

    Parameters

    • Optional token: string

      The token for the webhook, if not already present.

    Returns Promise<void>

  • Execute this webhook as GitHub compatible.

    Parameters

    • options: Record<string, unknown> & {
          wait: false;
      }

      The options to send. See GitHub's documentation for more information.

    • Optional token: string

      The token for the webhook, if not already present.

    Returns Promise<void>

  • Type Parameters

    Parameters

    • options: Record<string, unknown> & {
          wait?: true;
      }
    • Optional token: string

    Returns Promise<Message<T>>

  • Get a webhook message.

    Type Parameters

    Parameters

    • messageID: string

      The ID of the message.

    • Optional threadID: string

      The ID of the thread the message is in.

    • Optional token: string

      The token for the webhook, if not already present.

    Returns Promise<Message<T>>

  • The url of this webhook's sourceGuild icon (only present on channel follower webhooks).

    Parameters

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

      The format the url should be.

    • Optional size: number

      The dimensions of the image.

    Returns null | string