class WebhookClient

extends

BaseClient
export class WebhookClient extends BaseClient

The webhook client.

Constructors

constructor()

readonly
client : this

readonly
createdAt : Date

The time the webhook was created at

readonly
createdTimestamp : number

The timestamp the webhook was created at

id : Snowflake

The webhook's id

The options the webhook client was instantiated with.

rest : REST

The REST manager of the client

Inherited from: BaseClient

token : string

readonly
url : string

The URL of this webhook

The options the client was instantiated with

Inherited from: BaseClient

rest : REST

The REST manager of the client

Inherited from: BaseClient

[Symbol.asyncDispose]() : Promise<void>

Inherited from: BaseClient

delete(
reason?: string
) : Promise<void>

Deletes the webhook.

deleteMessage(
message: MessageResolvable | '@original'
threadId?: Snowflake
) : Promise<void>

Delete a message that was sent by this webhook.

deleteWebhook() : Promise<void>

Deletes a webhook.

Inherited from: BaseClient

destroy() : void

Destroys all assets used by the base client.

Inherited from: BaseClient

Edits this webhook.

Edits a message that was sent by this webhook.

Returns: Returns the message edited by this webhook

fetchMessage() : Promise<APIMessage>

Gets a message that was sent by this webhook.

Returns: Returns the message sent by this webhook

Sends a message with this webhook.

sendSlackMessage(
body: object
) : Promise<boolean>

Sends a raw slack message with this webhook.

Examples:
// Send a slack message
webhook.sendSlackMessage({
  'username': 'Wumpus',
  'attachments': [{
    'pretext': 'this looks pretty cool',
    'color': '#F0F',
    'footer_icon': 'http://snek.s3.amazonaws.com/topSnek.png',
    'footer': 'Powered by sneks',
    'ts': Date.now() / 1_000
  }]
}).catch(console.error);

toJSON(
...props: Record<string, boolean | string>[]
) : unknown

Inherited from: BaseClient

[Symbol.asyncDispose]() : Promise<void>

Inherited from: BaseClient

deleteWebhook() : Promise<void>

Deletes a webhook.

Inherited from: BaseClient

destroy() : void

Destroys all assets used by the base client.

Inherited from: BaseClient

toJSON(
...props: Record<string, boolean | string>[]
) : unknown

Inherited from: BaseClient