Class: WebhookClient

WebhookClient

The webhook client.

Constructor

new WebhookClient(id, token, optionsopt)

Parameters:
Name Type Attributes Description
id Snowflake ID of the webhook
token string Token of the webhook
options ClientOptions <optional>
Options for the client
Implements:
Source:
Example
// Create a new webhook and send a message
const hook = new Discord.WebhookClient('1234', 'abcdef');
hook.send('This will send a message').catch(console.error);

Extends

Members

(private) _immediates :Set.<Immediate>

Intervals set by BaseClient#setImmediate that are still active
Type:
  • Set.<Immediate>
Overrides:
Source:

(private) _intervals :Set.<Timeout>

Intervals set by BaseClient#setInterval that are still active
Type:
  • Set.<Timeout>
Overrides:
Source:

(private) _timeouts :Set.<Timeout>

Timeouts set by BaseClient#setTimeout that are still active
Type:
  • Set.<Timeout>
Overrides:
Source:

(private, readonly) api :Object

API shortcut
Type:
  • Object
Overrides:
Source:

id :Snowflake

The ID of the webhook
Type:
Implements:
Source:

options :ClientOptions

The options the client was instantiated with
Type:
Overrides:
Source:

(private) rest :RESTManager

The REST manager of the client
Type:
  • RESTManager
Overrides:
Source:

Methods

clearImmediate(immediate)

Clears an immediate.
Parameters:
Name Type Description
immediate Immediate Immediate to cancel
Overrides:
Source:

clearInterval(interval)

Clears an interval.
Parameters:
Name Type Description
interval Timeout Interval to cancel
Overrides:
Source:

clearTimeout(timeout)

Clears a timeout.
Parameters:
Name Type Description
timeout Timeout Timeout to cancel
Overrides:
Source:

(private) decrementMaxListeners()

Decrements max listeners by one, if they are not zero.
Overrides:
Source:

destroy()

Destroys all assets used by the base client.
Overrides:
Source:

(private) incrementMaxListeners()

Increments max listeners by one, if they are not zero.
Overrides:
Source:

setImmediate(fn, …args) → {Immediate}

Sets an immediate that will be automatically cancelled if the client is destroyed.
Parameters:
Name Type Attributes Description
fn function Function to execute
args * <repeatable>
Arguments for the function
Overrides:
Source:
Returns:
Type
Immediate

setInterval(fn, delay, …args) → {Timeout}

Sets an interval that will be automatically cancelled if the client is destroyed.
Parameters:
Name Type Attributes Description
fn function Function to execute
delay number Time to wait between executions (in milliseconds)
args * <repeatable>
Arguments for the function
Overrides:
Source:
Returns:
Type
Timeout

setTimeout(fn, delay, …args) → {Timeout}

Sets a timeout that will be automatically cancelled if the client is destroyed.
Parameters:
Name Type Attributes Description
fn function Function to execute
delay number Time to wait before executing (in milliseconds)
args * <repeatable>
Arguments for the function
Overrides:
Source:
Returns:
Type
Timeout