BotMine›Developer Docs›Slash Commands
Lua Addon SDK
Slash Commands
Registriere Slash Commands und lies Optionen aus.
Einfacher Command
luadiscord.slashCommand("ping", "Antwortet mit Pong", function(event) event.reply("Pong!") end)
Optionen
luadiscord.slashCommand("avatar", "Zeigt den Avatar eines Users", function(event) local user = event.getUser("user") or event.user event.reply(user.avatarUrl or "Kein Avatar gefunden.") end) :addUserOption("user", "User", false)
Option-Typen:
STRINGINTEGERNUMBERBOOLEANUSERMEMBERCHANNELROLEMENTIONABLEATTACHMENT
Command-Objekt
luadiscord.registerSlashCommand({ name = "say", description = "Sendet eine Nachricht", options = { { name = "text", description = "Nachricht", type = "STRING", required = true } } }, function(event) event.reply(event.getString("text", "")) end)
Antworten
SlashCommandEvent bietet:
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)