BotMine›Developer Docs›Slash Commands
Lua Addon SDK
Slash Commands
Register slash commands and read options.
Simple command
luadiscord.slashCommand("ping", "Replies with Pong", function(event) event.reply("Pong!") end)
Options
luadiscord.slashCommand("avatar", "Shows a user's avatar", function(event) local user = event.getUser("user") or event.user event.reply(user.avatarUrl or "No avatar found.") end) :addUserOption("user", "User", false)
Option types:
STRINGINTEGERNUMBERBOOLEANUSERMEMBERCHANNELROLEMENTIONABLEATTACHMENT
Command object
luadiscord.registerSlashCommand({ name = "say", description = "Sends a message", options = { { name = "text", description = "Message", type = "STRING", required = true } } }, function(event) event.reply(event.getString("text", "")) end)
Replies
SlashCommandEvent provides:
reply(content)replyEphemeral(content)deferReply(ephemeral?)editReply(content)followUp(content, ephemeral?)showModal(modal)replyWithButtons(content, buttons)replyWithButtonsEphemeral(content, buttons)replyEmbedWithButtons(embed, buttons)replyEmbedWithButtonsEphemeral(embed, buttons)