-
Notifications
You must be signed in to change notification settings - Fork 144
Webhook
extends Snowflake
Represents a handle used to send webhook messages to a guild text channel in a one-way fashion. This class defines methods and properties for managing the webhook, not for sending messages.
Instances of this class should not be constructed by users.
Properties Inherited From Snowflake
Name | Type | Description |
---|---|---|
client | Client | A shortcut to the client object to which this container is visible. |
createdAt | number | The Unix time in seconds at which this object was created by Discord. Additional decimal points may be present, though only the first 3 (milliseconds) should be considered accurate. Equivalent to Date.parseSnowflake(Snowflake.id) . |
id | string | The Snowflake ID that can be used to identify the object. This is guaranteed to be unique except in cases where an object shares the ID of its parent. |
parent | Container/Client | The parent object of to which this container is a child. For example, the parent of a role is the guild in which the role exists. |
timestamp | string | The date and time at which this object was created by Discord, represented as an ISO 8601 string plus microseconds when available. Equivalent to Date.fromSnowflake(Snowflake.id):toISO() . |
Name | Type | Description |
---|---|---|
avatar | string/nil | The hash for the webhook's custom avatar, if one is set. |
avatarURL | string | Equivalent to the result of calling Webhook:getAvatarURL() . |
channelId | string | The ID of the channel in which this webhook exists. |
defaultAvatar | number | The default avatar for the webhook. See the defaultAvatar enumeration for a human-readable representation. This should always be defaultAvatar.blurple . |
defaultAvatarURL | string | Equivalent to the result of calling Webhook:getDefaultAvatarURL() . |
guildId | string | The ID of the guild in which this webhook exists. |
name | string | The name of the webhook. This should be between 2 and 32 characters in length. |
token | string | The token that can be used to access this webhook. |
type | number | The type of the webhook. See the webhookType enum for a human-readable representation. |
user | User/nil | The user that created this webhook. |
Methods Inherited From Snowflake
Defines the behavior of the ==
operator. Allows containers to be directly compared according to their type and __hash
return values.
Returns: boolean
Returns Snowflake.id
Returns: string
Defines the behavior of the tostring
function. All containers follow the format ClassName: hash
.
Returns: string
Returns a unique Date object that represents when the object was created by Discord. Equivalent to Date.fromSnowflake(Snowflake.id)
This method only operates on data in memory.
Returns: Date
Permanently deletes the webhook. This cannot be undone!
This method always makes an HTTP request.
Returns: boolean
Parameter | Type | Optional |
---|---|---|
size | number | ✔ |
ext | string | ✔ |
Returns a URL that can be used to view the webhooks's full avatar. If provided, the size must be a power of 2 while the extension must be a valid image format. If the webhook does not have a custom avatar, the default URL is returned.
This method only operates on data in memory.
Returns: string
Parameter | Type | Optional |
---|---|---|
size | number | ✔ |
Returns a URL that can be used to view the webhooks's default avatar.
This method only operates on data in memory.
Returns: string
Parameter | Type |
---|---|
avatar | Base64-Resolvable |
Sets the webhook's avatar. If nil
is passed, the avatar is removed.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
name | string |
Sets the webhook's name. This must be between 2 and 32 characters in length.
This method always makes an HTTP request.
Returns: boolean