Class Webhook

Represents a webhook.

Hierarchy

Constructors

Properties

_cachedChannel?: any
_cachedGuild?: any
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" | "id" | "icon">

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

  • get channel(): undefined | null | AnyTextableGuildChannel
  • The channel this webhook is for, if applicable.

    Returns undefined | null | AnyTextableGuildChannel

  • get createdAt(): Date
  • Returns Date

  • get guild(): null | Guild
  • The guild this webhook is for, if applicable. This will throw an error if the guild is not cached.

    Returns null | Guild

  • get url(): string
  • Returns string

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 a message from this webhook.

    Parameters

    • messageID: string

      The ID of the message.

    • Optional options: DeleteWebhookMessageOptions

      The options for deleting the message.

    • Optional token: string

      The token for the webhook, if not already present.

    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>

  • Edit this webhook (requires a bot user, see editToken).

    Parameters

    Returns Promise<Webhook>

  • Edit a webhook message.

    Type Parameters

    Parameters

    • messageID: string

      The ID of the message to edit.

    • options: EditWebhookMessageOptions

      The options for editing the message.

    • Optional token: string

      The token of the webhook.

    Returns Promise<Message<T>>

  • Edit a webhook via its token.

    Parameters

    • options: EditWebhookOptions

      The options for editing the webhook.

    • Optional token: string

      The token for the webhook, if not already present.

    Returns Promise<Webhook>

  • Execute the webhook.

    Type Parameters

    Parameters

    • options: ExecuteWebhookWaitOptions

      The options for executing the webhook.

    • Optional token: string

      The token for the webhook, if not already present.

    Returns Promise<Message<T>>

  • Parameters

    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>>

  • Execute this webhook as slack compatible.

    Parameters

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

      The options to send. See Slack'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

  • Returns JSONWebhook

  • Returns string

  • Parameters

    • data: unknown

    Returns void

  • Parameters

    • Optional timestamp: number | Date

    Returns string

  • Parameters

    • id: string

    Returns Date

  • Parameters

    • id: string

    Returns number

Generated using TypeDoc