Webhook - truemedian/Discordia GitHub Wiki

Inherits 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.

Methods

getAvatarURL
getDefaultAvatarURL
setName
setAvatar
delete

Properties

guildId
channelId
user
token
name
avatar
avatarURL
defaultAvatar
defaultAvatarURL

Inherited from Container
client
parent

Inherited from Snowflake
id
createdAt
timestamp

Methods

:getAvatarURL( [ size ], [ ext ] )

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.

Name Type Optional Optional
size number x
ext string x

Returns: string

:getDefaultAvatarURL( [ size ] )

Returns a URL that can be used to view the webhooks's default avatar.

Name Type Optional
size number x

Returns: string

:setName( name )

Sets the webhook's name. This must be between 2 and 32 characters in length.

Name Type
name string

Returns: boolean

:setAvatar( avatar )

Sets the webhook's avatar. If nil is passed, the avatar is removed.

Name Type
avatar Base64 Resolvable

Returns: boolean

:delete( )

Permanently deletes the webhook. This cannot be undone!

Returns: boolean

Properties

.guildId

The ID of the guild in which this webhook exists.

Type: string

.channelId

The ID of the channel in which this webhook exists.

Type: string

.user

The user that created this webhook.

Type: User|nil

.token

The token that can be used to access this webhook.

Type: string

.name

The name of the webhook. This should be between 2 and 32 characters in length.

Type: string

.avatar

The hash for the webhook's custom avatar, if one is set.

Type: string|nil

.avatarURL

Equivalent to the result of calling Webhook:getAvatarURL().

Type: string

.defaultAvatar

The default avatar for the webhook. See the defaultAvatar enumeration for a human-readable representation. This should always be defaultAvatar.blurple.

Type: number

.defaultAvatarURL

Equivalent to the result of calling Webhook:getDefaultAvatarURL().

Type: string

Inherited from Container

.client

A shortcut to the client object to which this container is visible.

Type: Client

.parent

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.

Type: Container|Client

Inherited from Snowflake

.id

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.

Type: string

.createdAt

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.

Type: number

.timestamp

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().

Type: string

⚠️ **GitHub.com Fallback** ⚠️