class WebhookClient

extends

WebhookMixin(BaseClient)
export class WebhookClient extends WebhookMixin(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

The webhook's id

The options the webhook client was instantiated with.

rest : REST

The REST manager of the client

token : string

readonly
url : string

The URL of this webhook

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.

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