DiscordLua
discorddiscord
v1.2.4
Install

Interaction

interaction
On this page

Interaction is a Discord interaction payload. Branch on type helpers such as :isChatInputCommand, then :reply, :deferReply, or :showModal.

interaction Module 1.2.4 REST Source

Properties

Interaction.appPermissions

# readonly
Name
appPermissions
Type
any
Access
readonly
Description
Instance field Interaction.appPermissions. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.applicationId

# readonly
Name
applicationId
Type
any
Access
readonly
Description
Instance field Interaction.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 Interaction.

Interaction.attachmentSizeLimit

# readonly
Name
attachmentSizeLimit
Type
any
Access
readonly
Description
Instance field Interaction.attachmentSizeLimit. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.authorizingIntegrationOwners

# readonly
Name
authorizingIntegrationOwners
Type
AuthorizingIntegrationOwners
Access
readonly
Description
Instance field Interaction.authorizingIntegrationOwners. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.
Related
AuthorizingIntegrationOwners

Interaction.channelId

# readonly
Name
channelId
Type
any
Access
readonly
Description
Instance field Interaction.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 Interaction.

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

Interaction.commandGuildId

# readonly
Name
commandGuildId
Type
any
Access
readonly
Description
Instance field Interaction.commandGuildId. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.commandId

# readonly
Name
commandId
Type
any
Access
readonly
Description
Instance field Interaction.commandId. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.commandName

# readonly
Name
commandName
Type
any
Access
readonly
Description
Instance field Interaction.commandName. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.commandType

# readonly
Name
commandType
Type
any
Access
readonly
Description
Instance field Interaction.commandType. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.component

# readonly
Name
component
Type
any
Access
readonly
Description
Instance field Interaction.component. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.componentType

# readonly
Name
componentType
Type
any
Access
readonly
Description
Instance field Interaction.componentType. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.components

# readonly
Name
components
Type
any
Access
readonly
Description
Instance field Interaction.components. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.context

# readonly
Name
context
Type
any
Access
readonly
Description
Instance field Interaction.context. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.customId

# readonly
Name
customId
Type
any
Access
readonly
Description
Instance field Interaction.customId. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.data

# readonly
Name
data
Type
any
Access
readonly
Description
Instance field Interaction.data. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.deferred

# readonly
Name
deferred
Type
any
Access
readonly
Description
Instance field Interaction.deferred. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.entitlements

# readonly
Name
entitlements
Type
Collection
Access
readonly
Description
Instance field Interaction.entitlements. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.
Related
Collection

Interaction.fields

# readonly
Name
fields
Type
any
Access
readonly
Description
Instance field Interaction.fields. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.guildId

# readonly
Name
guildId
Type
any
Access
readonly
Description
Instance field Interaction.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 Interaction.

Interaction.guildLocale

# readonly
Name
guildLocale
Type
any
Access
readonly
Description
Instance field Interaction.guildLocale. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.id

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

Interaction.locale

# readonly
Name
locale
Type
any
Access
readonly
Description
Instance field Interaction.locale. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.member

# readonly
Name
member
Type
Member
Access
readonly
Description
Guild member view of the user, when the event occurred in a guild.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.
Related
Member

Interaction.memberPermissions

# readonly
Name
memberPermissions
Type
any
Access
readonly
Description
Instance field Interaction.memberPermissions. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.message

# readonly
Name
message
Type
MessageMod
Access
readonly
Description
Instance field Interaction.message. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.options

# readonly
Name
options
Type
any
Access
readonly
Description
Instance field Interaction.options. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.raw

# readonly
Name
raw
Type
any
Access
readonly
Description
Instance field Interaction.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 Interaction.

Interaction.replied

# readonly
Name
replied
Type
any
Access
readonly
Description
Instance field Interaction.replied. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.responded

# readonly
Name
responded
Type
any
Access
readonly
Description
Instance field Interaction.responded. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.targetId

# readonly
Name
targetId
Type
any
Access
readonly
Description
Instance field Interaction.targetId. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Interaction.token

# readonly
Name
token
Type
any
Access
readonly
Description
Authentication token held by this Interaction. Do not log this value.
Availability
Set by login. Do not log this value.

Interaction.type

# readonly
Name
type
Type
any
Access
readonly
Description
Instance field Interaction.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 Interaction.

Interaction.user

# readonly
Name
user
Type
User
Access
readonly
Description
User object associated with this Interaction.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.
Related
User

Interaction.version

# readonly
Name
version
Type
any
Access
readonly
Description
Instance field Interaction.version. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this Interaction.

Methods

Interaction:awaitModalSubmit()

#

Performs await modal submit on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:awaitModalSubmit(options, callback)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Interaction — the same instance, for chaining.

Throws

A DiscordLua error when arguments are invalid or the request fails without a callback.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:awaitModalSubmit({}, function(err, result)
    if err then error(err) end
end)

Interaction:channel()

#

Performs channel on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:channel()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:channel()

Interaction:command()

#

Performs command on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:command()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:command()

Interaction:createdAt()

#

Create dAt through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

Interaction:createdAt()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:createdAt()

Interaction:createdTimestamp()

#

Create dTimestamp through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

Interaction:createdTimestamp()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:createdTimestamp()

Interaction:deferReply()

#

Acknowledge an interaction with a deferred channel message.

Signature

Interaction:deferReply(ephemeral)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:deferReply(ephemeral)

Interaction:deferUpdate()

#

Performs defer update on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:deferUpdate()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:deferUpdate()

Interaction:deleteFollowUp()

#

Permanently delete FollowUp through REST.

Signature

Interaction:deleteFollowUp(messageId)

Parameters

NameTypeRequiredBehavior
messageId string required Snowflake id string.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:deleteFollowUp("123")

Interaction:deleteReply()

#

Permanently delete Reply through REST.

Signature

Interaction:deleteReply()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:deleteReply()

Interaction:editFollowUp()

#

Apply a REST update to FollowUp and refresh the local object when the request succeeds.

Signature

Interaction:editFollowUp(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

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:editFollowUp("123", "Hello")

Interaction:editReply()

#

Apply a REST update to Reply and refresh the local object when the request succeeds.

Signature

Interaction:editReply(contentOrOptions, callback)

Parameters

NameTypeRequiredBehavior
contentOrOptions table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:editReply("Hello", function(err, result)
    if err then error(err) end
end)

Interaction:ephemeral()

#

Performs ephemeral on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:ephemeral()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:ephemeral()

Interaction:fetchFollowUp()

#

Fetch FollowUp from REST and update the local cache when the request succeeds.

Signature

Interaction:fetchFollowUp(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

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:fetchFollowUp("123", function(err, result)
    if err then error(err) end
end)

Interaction:fetchReply()

#

Fetch Reply from REST and update the local cache when the request succeeds.

Signature

Interaction:fetchReply(callback)

Parameters

NameTypeRequiredBehavior
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:fetchReply(function(err, result)
    if err then error(err) end
end)

Interaction:fetchResponse()

#

Fetch Response from REST and update the local cache when the request succeeds.

Signature

Interaction:fetchResponse()

Parameters

No parameters.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:fetchResponse()

Interaction:followUp()

#

Send an additional webhook follow-up after the first response.

Signature

Interaction:followUp(contentOrOptions, callback)

Parameters

NameTypeRequiredBehavior
contentOrOptions table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:followUp("Hello", function(err, result)
    if err then error(err) end
end)

Interaction:getAttachment()

#

Read the Attachment value from this Interaction.

Signature

Interaction:getAttachment(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getAttachment(name, required)

Interaction:getBoolean()

#

Read the Boolean value from this Interaction.

Signature

Interaction:getBoolean(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getBoolean(name, required)

Interaction:getChannel()

#

Read the Channel value from this Interaction.

Signature

Interaction:getChannel(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getChannel(name, required)

Interaction:getFocused()

#

Read the Focused value from this Interaction.

Signature

Interaction:getFocused(getFull)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getFocused(getFull)

Interaction:getInteger()

#

Read the Integer value from this Interaction.

Signature

Interaction:getInteger(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getInteger(name, required)

Interaction:getMember()

#

Read the Member value from this Interaction.

Signature

Interaction:getMember(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getMember(name, required)

Interaction:getMentionable()

#

Read the Mentionable value from this Interaction.

Signature

Interaction:getMentionable(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getMentionable(name, required)

Interaction:getNumber()

#

Read the Number value from this Interaction.

Signature

Interaction:getNumber(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getNumber(name, required)

Interaction:getOption()

#

Read the Option value from this Interaction.

Signature

Interaction:getOption(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getOption(name, required)

Interaction:getRole()

#

Read the Role value from this Interaction.

Signature

Interaction:getRole(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getRole(name, required)

Interaction:getString()

#

Read the String value from this Interaction.

Signature

Interaction:getString(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getString(name, required)

Interaction:getSubcommand()

#

Read the Subcommand value from this Interaction.

Signature

Interaction:getSubcommand(required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getSubcommand(required)

Interaction:getSubcommandGroup()

#

Read the SubcommandGroup value from this Interaction.

Signature

Interaction:getSubcommandGroup(required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getSubcommandGroup(required)

Interaction:getTextInputValue()

#

Read the TextInputValue value from this Interaction.

Signature

Interaction:getTextInputValue(customId, required)

Parameters

NameTypeRequiredBehavior
customId string required Snowflake id string.
required any required Passed through to the implementation as written.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getTextInputValue("123", required)

Interaction:getUser()

#

Read the User value from this Interaction.

Signature

Interaction:getUser(name, required)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:getUser(name, required)

Interaction:guild()

#

Performs guild on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:guild()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:guild()

Interaction:inCachedGuild()

#

Predicate that returns whether this Interaction matches inCachedGuild. Use it to branch before calling type-specific methods.

Signature

Interaction:inCachedGuild()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:inCachedGuild()

Interaction:inGuild()

#

Predicate that returns whether this Interaction matches inGuild. Use it to branch before calling type-specific methods.

Signature

Interaction:inGuild()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:inGuild()

Interaction:inRawGuild()

#

Predicate that returns whether this Interaction matches inRawGuild. Use it to branch before calling type-specific methods.

Signature

Interaction:inRawGuild()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:inRawGuild()

Interaction:isAnySelectMenu()

#

Predicate that returns whether this Interaction matches isAnySelectMenu. Use it to branch before calling type-specific methods.

Signature

Interaction:isAnySelectMenu()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isAnySelectMenu()

Interaction:isAutocomplete()

#

Predicate that returns whether this Interaction matches isAutocomplete. Use it to branch before calling type-specific methods.

Signature

Interaction:isAutocomplete()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isAutocomplete()

Interaction:isButton()

#

Predicate that returns whether this Interaction matches isButton. Use it to branch before calling type-specific methods.

Signature

Interaction:isButton()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isButton()

Interaction:isChannelSelectMenu()

#

Predicate that returns whether this Interaction matches isChannelSelectMenu. Use it to branch before calling type-specific methods.

Signature

Interaction:isChannelSelectMenu()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isChannelSelectMenu()

Interaction:isChatInputCommand()

#

Predicate that returns whether this Interaction matches isChatInputCommand. Use it to branch before calling type-specific methods.

Signature

Interaction:isChatInputCommand()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isChatInputCommand()

Interaction:isCommand()

#

Predicate that returns whether this Interaction matches isCommand. Use it to branch before calling type-specific methods.

Signature

Interaction:isCommand()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isCommand()

Interaction:isContextMenuCommand()

#

Predicate that returns whether this Interaction matches isContextMenuCommand. Use it to branch before calling type-specific methods.

Signature

Interaction:isContextMenuCommand()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isContextMenuCommand()

Interaction:isFromMessage()

#

Predicate that returns whether this Interaction matches isFromMessage. Use it to branch before calling type-specific methods.

Signature

Interaction:isFromMessage()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isFromMessage()

Interaction:isMentionableSelectMenu()

#

Predicate that returns whether this Interaction matches isMentionableSelectMenu. Use it to branch before calling type-specific methods.

Signature

Interaction:isMentionableSelectMenu()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isMentionableSelectMenu()

Interaction:isMessageComponent()

#

Predicate that returns whether this Interaction matches isMessageComponent. Use it to branch before calling type-specific methods.

Signature

Interaction:isMessageComponent()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isMessageComponent()

Interaction:isMessageContextMenuCommand()

#

Predicate that returns whether this Interaction matches isMessageContextMenuCommand. Use it to branch before calling type-specific methods.

Signature

Interaction:isMessageContextMenuCommand()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isMessageContextMenuCommand()

Interaction:isModalSubmit()

#

Predicate that returns whether this Interaction matches isModalSubmit. Use it to branch before calling type-specific methods.

Signature

Interaction:isModalSubmit()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isModalSubmit()

Interaction:isPrimaryEntryPointCommand()

#

Predicate that returns whether this Interaction matches isPrimaryEntryPointCommand. Use it to branch before calling type-specific methods.

Signature

Interaction:isPrimaryEntryPointCommand()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isPrimaryEntryPointCommand()

Interaction:isRepliable()

#

Predicate that returns whether this Interaction matches isRepliable. Use it to branch before calling type-specific methods.

Signature

Interaction:isRepliable()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isRepliable()

Interaction:isRoleSelectMenu()

#

Predicate that returns whether this Interaction matches isRoleSelectMenu. Use it to branch before calling type-specific methods.

Signature

Interaction:isRoleSelectMenu()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isRoleSelectMenu()

Interaction:isSelectMenu()

#

Predicate that returns whether this Interaction matches isSelectMenu. Use it to branch before calling type-specific methods.

Signature

Interaction:isSelectMenu()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isSelectMenu()

Interaction:isStringSelectMenu()

#

Predicate that returns whether this Interaction matches isStringSelectMenu. Use it to branch before calling type-specific methods.

Signature

Interaction:isStringSelectMenu()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isStringSelectMenu()

Interaction:isUserContextMenuCommand()

#

Predicate that returns whether this Interaction matches isUserContextMenuCommand. Use it to branch before calling type-specific methods.

Signature

Interaction:isUserContextMenuCommand()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isUserContextMenuCommand()

Interaction:isUserSelectMenu()

#

Predicate that returns whether this Interaction matches isUserSelectMenu. Use it to branch before calling type-specific methods.

Signature

Interaction:isUserSelectMenu()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:isUserSelectMenu()

Interaction:launchActivity()

#

Performs launch activity on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:launchActivity()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:launchActivity()

Interaction:reply()

#

Send a message in the same channel as a reply to this object.

Signature

Interaction:reply(contentOrOptions)

Parameters

NameTypeRequiredBehavior
contentOrOptions table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:reply("Hello")

Interaction:respondAutocomplete()

#

Performs respond autocomplete on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:respondAutocomplete(choices)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:respondAutocomplete(choices)

Interaction:sendPremiumRequired()

#

Send PremiumRequired using this Interaction.

Signature

Interaction:sendPremiumRequired()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:sendPremiumRequired()

Interaction:showModal()

#

Open a modal UI for this interaction.

Signature

Interaction:showModal(modal)

Parameters

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

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:showModal(modal)

Interaction:toJSON()

#

Serialize this Interaction into a Lua table suitable for REST or debugging.

Signature

Interaction:toJSON()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:toJSON()

Interaction:toString()

#

function toString() { [native code] }

Signature

Interaction:toString()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:toString()

Interaction:update()

#

Performs update on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:update(contentOrOptions)

Parameters

NameTypeRequiredBehavior
contentOrOptions table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:update("Hello")

Interaction:values()

#

Performs values on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:values()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:values()

Interaction:webhook()

#

Performs webhook on this Interaction. Call it from bot code when you need that operation on the current object.

Signature

Interaction:webhook()

Parameters

No parameters.

Returns

Interaction — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a Interaction
object:webhook()

Static members

  • Interaction.AuthorizingIntegrationOwners
  • Interaction.AutocompleteInteraction
  • Interaction.ButtonInteraction
  • Interaction.ChannelSelectMenuInteraction
  • Interaction.ChatInputCommandInteraction
  • Interaction.CommandInteraction
  • Interaction.ContextMenuCommandInteraction
  • Interaction.InteractionResponse
  • Interaction.MentionableSelectMenuInteraction
  • Interaction.MessageComponentInteraction
  • Interaction.MessageContextMenuCommandInteraction
  • Interaction.ModalSubmitInteraction
  • Interaction.PrimaryEntryPointCommandInteraction
  • Interaction.RoleSelectMenuInteraction
  • Interaction.SelectMenuInteraction
  • Interaction.StringSelectMenuInteraction
  • Interaction.UserContextMenuCommandInteraction
  • Interaction.UserSelectMenuInteraction

Examples

Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.

AutocompleteInteraction · ButtonInteraction · ChannelSelectMenuInteraction · ChatInputCommandInteraction · ContextMenuCommandInteraction · MentionableSelectMenuInteraction · MessageComponentInteraction · MessageContextMenuCommandInteraction

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc