kiểu options gốc của command
danh sách subcommand trực tiếp
danh sách subcommand group
Khởi tạo SlashCommandBuilder.
Nếu truyền config, builder sẽ tự động áp dụng cấu hình
thông qua applyConfig.
kiểu options gốc của command
danh sách subcommand trực tiếp
danh sách subcommand group
Optionalconfig: SlashCommandBuilderOptions<TOptions, TSubs, TGroups>cấu hình khởi tạo command
Tên slash command.
Ví dụ:
/ping
/admin
OptionalcooldownCấu hình cooldown để tránh spam command.
Mô tả command hiển thị trong Discord.
OptionaluserCấu hình quyền người dùng cần có để sử dụng command.
Lấy options đã được build.
Build Discord SlashCommandBuilder để đăng ký với Discord API.
Method này:
DiscordSlashCommandBuilder
Set cooldown cho command.
cấu hình cooldown
Set mô tả command.
mô tả command
Set function xử lý khi command được execute.
function handler
Hàm thực thi khi slash command được gọi.
Discord Client
interaction của slash command
object đã được parse và type-safe
options bao gồm:
Ví dụ payload:
options.payload
có thể là:
{ type: "sub", sub: "ping", options: {} }
hoặc
{
type: "group",
group: "admin",
sub: "ban",
options: { user: User }
}
Set subcommand groups cho command.
Groups dùng để tổ chức command lớn.
Set tên command.
tên command
Định nghĩa options cho command.
function tạo options
Set subcommands cho command.
danh sách subcommands
Set permission yêu cầu để sử dụng command.
permission config
Builder chính dùng để định nghĩa một Slash Command.
Class này chịu trách nhiệm:
Đây là class trung tâm của hệ thống slash command trong framework.
Example
Command đơn giản
Example
Command có options
Example
Command có subcommand
Example
Command có subcommand group
Cấu trúc lệnh: