First Command
Bu içerik henüz dilinizde mevcut değil.
Introduction
In this guide, we’ll walk you through creating your first command module.
If you installed a new project via the CLI, your file should be here:
Dizinsrc/commands/
- ping.ts (right here, probably)
- …
To view what each of these properties mean in depth, visit the docs for CommandType
.
Command Module Types
Every command module type
is part of an enum. This field allows type inference for the rest of a module’s fields.
All the command types can be found in the CommandType
enum!
Example Modal Command
So, lets say you want to make a command module that listens to modals.
Commands are straight forward. Keep in mind, the only required fields for command modules are the type
and execute
function.
Context Class
The provided Context
class helps with modules of CommandType.Both
(A mixture of slash / legacy commands).
The Context
class is passed into modules with type:
CommandType.Both
CommandType.Slash
CommandType.Text
This data structure helps interop between legacy commands and slash commands with ease.