Interaction

The interaction class.

Constructor

new Interaction(client, handler, channel, d);

Parameter

Type

Required

Default

Description

client

true

none

The client this interaction uses.

handler

true

none

The handler this command uses

channel

true

none

The TextChannel this interaction was called in.

d

any

true

none

The raw Gateway event data.

Properties

id

ID of this interaction. Type: string

type

The type of this interaction. Type: InteractionType

data

The data used by this interaction. Type: InteractionData

guild

The guild this command has been executed in. Type: Discord.Guild

channel

The channel this command has been executed in. Type: Discord.TextChannel

member

The member that executed this command. Type: Discord.GuildMember

client

The client this interaction uses. Type: Discord.Client

handler

The command handler this interaction uses. Type: SlashCommandHandler

reply_send

Used to check if a reply has already been send. There is a maximum of 1 reply each interaction. Type: bool

Methods

option<T = any>(option: string | string[])

Easily get an specified option. Returns: T | undefined | null

const user = interaction.option<User>('mute user');

@DEPRECATED getOption<T = any>(option: string)

Get an specified option from all options. Returns: InteractionOption<T>

interaction.getOption<User>('mute user');

async send(...messages: InteractionMessageType[])

Send a message back to the user, this won't display source and closes the callback. Returns: InteractionMessage

async reply(...messages: InteractionMessageType[])

Send a message back to the user, this will display source and close the callback. Returns: InteractionMessage

async pong(showSource: bool = true)

Close the interaction callback. Returns: void

async parseOptions(command: SlashCommand)

Parse the interaction options using the command. Returns: void

Last updated

Was this helpful?