class WebhookClient
extends
BaseClientexport class WebhookClient extends BaseClient
The webhook client.
Constructors
data: WebhookClientDataoptions?: WebhookClientOptions)
constructor(data: WebhookClientData
options?: WebhookClientOptions
readonlyDate createdAt :
The time the webhook was created at
readonlynumber createdTimestamp :
The timestamp the webhook was created at
Snowflake id :
The webhook's id
WebhookClientOptions options :
The options the webhook client was instantiated with.
string token :
readonlystring url :
The URL of this webhook
Inherited from: BaseClient
deleteMessagemessage: MessageResolvable | '@original'threadId?: Snowflake) : Promise<void> (
message: MessageResolvable | '@original'
threadId?: Snowflake
Delete a message that was sent by this webhook.
deleteWebhookid: Snowflakeoptions?: WebhookDeleteOptions) : Promise<void> (
id: Snowflake
options?: WebhookDeleteOptions
Deletes a webhook.
Inherited from: BaseClient
editoptions: WebhookEditOptions) : Promise<Webhook> (
options: WebhookEditOptions
Edits this webhook.
editMessagemessage: MessageResolvableoptions: string | MessagePayload | WebhookMessageEditOptions) : Promise<APIMessage> (
message: MessageResolvable
options: string | MessagePayload | WebhookMessageEditOptions
Edits a message that was sent by this webhook.
Returns: Returns the message edited by this webhook
fetchMessagemessage: Snowflakeoptions?: WebhookFetchMessageOptions = {}) : Promise<APIMessage> (
message: Snowflake
options?: WebhookFetchMessageOptions = {}
Gets a message that was sent by this webhook.
Returns: Returns the message sent by this webhook
sendoptions: string | MessagePayload | WebhookMessageCreateOptions) : Promise<APIMessage> (
options: string | MessagePayload | WebhookMessageCreateOptions
Sends a message with this webhook.
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);