InteractionWebhook
ClassOn this page
InteractionWebhook is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.
Constructor
InteractionWebhook.new(client, id, token) The class table is callable, so InteractionWebhook(client, id, token) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
client |
any |
required | Passed through to the implementation as written. |
id |
string |
required | Snowflake id string. |
token |
string |
optional | Bot token. When omitted, Client:login reads DISCORD_TOKEN. |
local discord = require("discord")
local object = discord.InteractionWebhook({}, {}, os.getenv("DISCORD_TOKEN"))Properties
- 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 InteractionWebhook.
- Name
id- Type
any- Access
- readonly
- Description
- Snowflake id of this InteractionWebhook.
- Availability
- Populated from the Gateway/REST payload or constructor for this InteractionWebhook.
- Name
token- Type
any- Access
- readonly
- Description
- Authentication token held by this InteractionWebhook. Do not log this value.
- Availability
- Set by
login. Do not log this value.
- Name
url- Type
any- Access
- readonly
- Description
- Instance field
InteractionWebhook.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 InteractionWebhook.
Methods
InteractionWebhook:deleteMessage()
#Permanently delete Message through REST.
Signature
InteractionWebhook:deleteMessage(messageId) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
messageId |
string |
required | Snowflake id string. |
Returns
InteractionWebhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a InteractionWebhook
object:deleteMessage("123")InteractionWebhook:editMessage()
#Apply a REST update to Message and refresh the local object when the request succeeds.
Signature
InteractionWebhook: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
InteractionWebhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a InteractionWebhook
object:editMessage("123", "Hello")InteractionWebhook:fetchMessage()
#Fetch Message from REST and update the local cache when the request succeeds.
Signature
InteractionWebhook: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
InteractionWebhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a InteractionWebhook
object:fetchMessage("123", function(err, result)
if err then error(err) end
end)InteractionWebhook:path()
#Performs path on this InteractionWebhook. Call it from bot code when you need that operation on the current object.
Signature
InteractionWebhook:path(suffix) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
suffix |
any |
required | Passed through to the implementation as written. |
Returns
InteractionWebhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a InteractionWebhook
object:path(suffix)InteractionWebhook:send()
#Send a message, payload, or packet using this object.
Signature
InteractionWebhook: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
InteractionWebhook — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a InteractionWebhook
object:send("Hello")Examples
local discord = require("discord")
local object = discord.InteractionWebhook({})Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment
Version: discord 1.2.4 · runtime 1.0.0