DiscordLua
discorddiscord
v1.2.4
Install

InteractionWebhook

Class
On 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.

class Module 1.2.4 Source

Constructor

InteractionWebhook.new(client, id, token)

The class table is callable, so InteractionWebhook(client, id, token) is the same as .new.

NameTypeRequiredBehavior
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.
lua
local discord = require("discord")
local object = discord.InteractionWebhook({}, {}, os.getenv("DISCORD_TOKEN"))

Properties

InteractionWebhook.client

# readonly
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.

InteractionWebhook.id

# readonly
Name
id
Type
any
Access
readonly
Description
Snowflake id of this InteractionWebhook.
Availability
Populated from the Gateway/REST payload or constructor for this InteractionWebhook.

InteractionWebhook.token

# readonly
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.

InteractionWebhook.url

# readonly
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

NameTypeRequiredBehavior
messageId string required Snowflake id string.

Returns

InteractionWebhook — the same instance, for chaining.

Example

lua
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

NameTypeRequiredBehavior
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

lua
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

NameTypeRequiredBehavior
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

lua
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

NameTypeRequiredBehavior
suffix any required Passed through to the implementation as written.

Returns

InteractionWebhook — the same instance, for chaining.

Example

lua
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

NameTypeRequiredBehavior
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

lua
local discord = require("discord")
-- object is a InteractionWebhook
object:send("Hello")

Examples

lua
local discord = require("discord")
local object = discord.InteractionWebhook({})

ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc