SlashInteraction - BestMordaEver/Discordia GitHub Wiki

extends Interaction

Defines the base methods and properties for Discord interactions that are received when a user uses a slash command.

Instances of this class should not be constructed by users.

Properties Inherited From Interaction

Name Type Description
channel TextChannel The channel in which this interaction happened.
client Client A shortcut to the client object to which this container is visible.
createdAt number 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. Equivalent to Date.parseSnowflake(Snowflake.id).
guild Guild/nil The guild in which this interaction happened. This will not exist if the interaction was not sent in a guild text channel. Equivalent to Interaction.channel.guild.
guild_locale string/nil The guild's preferred locale, if invoked in a guild.
id string 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.
locale string The selected language of the invoking user.
member Member/nil The member object of the interaction user. This will not exist if the interaction was not sent in a guild text channel or if the member object is not cached. Equivalent to Interaction.guild.members:get(Interaction.author.id).
parent Container/Client 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.
timestamp string 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().
token string A continuation token for responding to the interaction. Valid for 15 minutes.
type number The interaction type. See the interactionType enumeration for a human-readable representation.
user User The object of the user that created the interaction.

Properties

Name Type Description
commandId string The ID of the invoked command.
commandName string The name of the invoked command.
commandType number The type of the invoked command. See the applicationCommandType enumeration for a human-readable representation.
option CommandOption/nil Suboption if this option is a group or subcommand. Only exists when there's one suboption.
options table/nil Table of command options received from the user.
target Member/Message/nil Member or message targetted by a user or message command.

Methods Inherited From Interaction

__eq()

Defines the behavior of the == operator. Allows containers to be directly compared according to their type and __hash return values.

Returns: boolean


__hash()

Returns Snowflake.id

Returns: string


__tostring()

Defines the behavior of the tostring function. All containers follow the format ClassName: hash.

Returns: string


getDate()

Returns a unique Date object that represents when the object was created by Discord. Equivalent to Date.fromSnowflake(Snowflake.id)

This method only operates on data in memory.

Returns: Date


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