Webhook
ClassOn this page
Webhook is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.
Properties
- Name
applicationId- Type
any- Access
- readonly
- Description
- Instance field
Webhook.applicationId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
avatar- Type
any- Access
- readonly
- Description
- Instance field
Webhook.avatar. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
channelId- Type
any- Access
- readonly
- Description
- Instance field
Webhook.channelId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
client- Type
any- Access
- readonly
- Description
- Owning Client instance used for REST, cache, and event dispatch.
- Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
guildId- Type
any- Access
- readonly
- Description
- Instance field
Webhook.guildId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
id- Type
any- Access
- readonly
- Description
- Snowflake id of this Webhook.
- Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
name- Type
any- Access
- readonly
- Description
- Display name of this Webhook.
- Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
owner- Type
any- Access
- readonly
- Description
- Instance field
Webhook.owner. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
raw- Type
any- Access
- readonly
- Description
- Instance field
Webhook.raw. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
sourceChannel- Type
any- Access
- readonly
- Description
- Instance field
Webhook.sourceChannel. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
sourceGuild- Type
any- Access
- readonly
- Description
- Instance field
Webhook.sourceGuild. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
token- Type
any- Access
- readonly
- Description
- Authentication token held by this Webhook. Do not log this value.
- Availability
- Set by
login. Do not log this value.
- Name
type- Type
any- Access
- readonly
- Description
- Instance field
Webhook.type. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
- Name
url- Type
any- Access
- readonly
- Description
- Instance field
Webhook.url. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Webhook.
Methods
Webhook:avatarURL()
#Performs avatar url on this Webhook. Call it from bot code when you need that operation on the current object.
Signature
Webhook:avatarURL(options) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
options |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:avatarURL({})Webhook:channel()
#Performs channel on this Webhook. Call it from bot code when you need that operation on the current object.
Signature
Webhook:channel() Parameters
No parameters.
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:channel()Webhook:createdAt()
#Create dAt through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.
Signature
Webhook:createdAt() Parameters
No parameters.
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:createdAt()Webhook:createdTimestamp()
#Create dTimestamp through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.
Signature
Webhook:createdTimestamp() Parameters
No parameters.
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:createdTimestamp()Webhook:delete()
#Permanently delete this resource through REST.
Signature
Webhook:delete() Parameters
No parameters.
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:delete()Webhook:deleteMessage()
#Permanently delete Message through REST.
Signature
Webhook:deleteMessage(messageId) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
messageId |
string |
required | Snowflake id string. |
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:deleteMessage("123")Webhook:edit()
#Apply a REST update to this resource.
Signature
Webhook:edit(options) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
options |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:edit({})Webhook:editMessage()
#Apply a REST update to Message and refresh the local object when the request succeeds.
Signature
Webhook:editMessage(messageId, contentOrOptions) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
messageId |
string |
required | Snowflake id string. |
contentOrOptions |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:editMessage("123", "Hello")Webhook:fetchMessage()
#Fetch Message from REST and update the local cache when the request succeeds.
Signature
Webhook:fetchMessage(messageId, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
messageId |
string |
required | Snowflake id string. |
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:fetchMessage("123", function(err, result)
if err then error(err) end
end)Webhook:isApplicationCreated()
#Predicate that returns whether this Webhook matches isApplicationCreated. Use it to branch before calling type-specific methods.
Signature
Webhook:isApplicationCreated() Parameters
No parameters.
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:isApplicationCreated()Webhook:isChannelFollower()
#Predicate that returns whether this Webhook matches isChannelFollower. Use it to branch before calling type-specific methods.
Signature
Webhook:isChannelFollower() Parameters
No parameters.
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:isChannelFollower()Webhook:isIncoming()
#Predicate that returns whether this Webhook matches isIncoming. Use it to branch before calling type-specific methods.
Signature
Webhook:isIncoming() Parameters
No parameters.
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:isIncoming()Webhook:isUserCreated()
#Predicate that returns whether this Webhook matches isUserCreated. Use it to branch before calling type-specific methods.
Signature
Webhook:isUserCreated() Parameters
No parameters.
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:isUserCreated()Webhook:path()
#Performs path on this Webhook. Call it from bot code when you need that operation on the current object.
Signature
Webhook:path(suffix) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
suffix |
any |
required | Passed through to the implementation as written. |
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:path(suffix)Webhook:send()
#Send a message, payload, or packet using this object.
Signature
Webhook:send(contentOrOptions) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
contentOrOptions |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:send("Hello")Webhook:sendSlackMessage()
#Send SlackMessage using this Webhook.
Signature
Webhook:sendSlackMessage(body) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
body |
any |
required | Passed through to the implementation as written. |
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
object:sendSlackMessage(body)Performs wrap many on this Webhook. Call it from bot code when you need that operation on the current object.
Signature
Webhook.wrapMany(client, data) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
client |
any |
required | Passed through to the implementation as written. |
data |
any |
required | Passed through to the implementation as written. |
Returns
Webhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Webhook
Webhook.wrapMany(client, data)Examples
Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.
Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment
Version: discord 1.2.4 · runtime 1.0.0