Class: Webhook

Webhook

Represents a webhook

new Webhook (url, username, avatarUrl)

Represents a new webhook

Name Type Default Description
url URL

Webhook-URL

username String null

Username of the webhook

avatarUrl URL null

URL to a avatar

Methods

delete ()Promise async

Deletes this message

Returns:
Type Description
Promise

edit (name, base64Avatar)Promise.<void> async

Edits this webhook object

Name Type Default Description
name String null

New username of the webhook

base64Avatar String null

Base64-String of your image. If you don't know how to use this, please google Image to Base64 nodejs or File to Base 64 if you have an image file.

Returns:
Type Description
Promise.<void>

fetchMessage (id)Promise.<Message> async

Fetches a message by ID (including content)

Name Type Description
id String

ID of the message

Returns:
Type Description
Promise.<Message> Message

resolveMessageID (messageID)Message

Resolves a message by ID (will not include any content of this message. Only use this if you want to edit or delate already send messages without having to fetch the message again

Name Type Description
messageID
Returns:
Type Description
Message

send (content, embeds, allowedMentions, tts, components)Promise.<Message> async

Creates a new message as the webhook

Name Type Default Description
content String

Content of this message

embeds Array.<Object>

Array of Embed-Objects

allowedMentions Object

Allowed-Mentions-Object

tts Boolean false

If enabled, discord will read out the messages to everyone who hase this channel open

components Array

Message-Component-Object. ⚠ This will only work, if your webhook is owned by an application.

Returns:
Type Description
Promise.<Message> New message