Discord-S.C.U.M icon indicating copy to clipboard operation
Discord-S.C.U.M copied to clipboard

Send slash command

Open KumaHugg opened this issue 2 years ago • 2 comments

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')

KumaHugg avatar Sep 02 '22 12:09 KumaHugg

@KumaHugg https://github.com/Merubokkusu/Discord-S.C.U.M/blob/master/examples/slashcommands.py

tanersb avatar Sep 11 '22 11:09 tanersb

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.

SimonNordon4 avatar Sep 11 '22 11:09 SimonNordon4