Open KumaHugg opened 2 years ago
slashCmds = bot.getSlashCommands(botID).json()
from discum.utils.slash import SlashCommander
s = SlashCommander(slashCmds)
data = s.get(['name_of_the_slash_command'], inputs={'name_of_the_options_in_the_slash_command':'the_options_input'})
bot.triggerSlashCommand(botID,channelID=channelID,guildID=guildID, data=data)
The first 3 lines of the code is retrieving and parsing the slash command options. line 4 allows you to retrieve slash commands and send them.
For example if the slash command is "info" and takes no arguments then data = s.get(['info'])
If the slash command is "imagine" and takes the argument "prompt" then data = s.get(['imagine'], inputs={'prompt':'this is an example prompt'})
This gives you the data in a way the api will accept. Finally you just need the bot ID you're trying to trigger, the guild id and the channel id.
Hi,does anyone know how to send slash command in channel? I try triggerslashcommand but not work(I don't know to code) pls send me code for send slash command(for example:channelId='10001',botId='111000',token='plshelp')