InteractionsClient
Main class for interacting with the Discord Interactions API
Source: lib/src/InteractionsClient.ts
Extends EventEmitter
Constructor
const client = await new InteractionsClient(options);
Parameter
Optional
Default
Type
Description
app_id
Nope
Snowflake
Your Discord application's ID
token
Nope
Token
Your bot token or OAuth token
token_type
Yup
"Bot"
TokenType
Whether your token is a Bot token of your application or it's an OAuth token
intents
Yup
32509
Number
Intents to use for the gateway
Events
interaction
Emits when a user uses a slash command
Parameters
d: Payload received by the client. The inner d
key is an Interaction object.
Properties
Property
Type
Description
commands
Map
A Map containing info about all the commands of the client
endpoint
String
Base API endpoint for the application
ws
WebSocket
The WebSocket connection of the client
s
Number
or null
The last sequence number received by the client
got_last_heartbeat
_ack
Boolean
Whether we got a heartbeat ACK back from the server on the last heartbeat
heartbeat_interval
Number
Interval in milliseconds to send heartbeats to the server to
intents
Number
Intents to use for the gateway
app_id
Snowflake
Your Discord Application's ID
token
Token
Your bot token or OAuth token
Methods
publishCommand<command: SlashCommand, guild_id?: Snowflake>
Publish the command to the API. If a command with the name already exists, it will overwrite the command.
Parameter
Optional
Type
Description
command
Nope
SlashCommand
SlashCommand to publish
guild_id
Yup
Snowflake
An optional guild ID to publish the command to instead of publishing it globally
Last updated
Was this helpful?