0

i would like to convert this code to support tree slash commands here is the code @client.command() async def poll(ctx, *, message): await ctx.channel.purge(limit=1) emb = discord.Embed(title=f"{message}", description=f"asked by @{ctx.message.author}", colour=random.choice(rcolor)) msg = await ctx.channel.send(embed=emb) await msg.add_reaction('') await msg.add_reaction('')

@client.tree.command(name="poll", description = "case a vote to decide something")
async def poll(interaction: discord.Interaction):
    #i dont know what to put next
emb = discord.Embed(title=f"{message}",
                        description=f"asked by @{ctx.message.author}",
                        colour=random.choice(rcolor))
    msg = await ctx.channel.send(embed=emb)
    await msg.add_reaction('')
    await msg.add_reaction('')

how can i do that?

my current command works but i would like to convert it to a slash command

CYKLER
  • 11
  • 3
  • you can look at this example, which could help you, https://github.com/Rapptz/discord.py/blob/master/examples/app_commands/basic.py. – Doluk Feb 01 '23 at 20:34
  • For further help could you please specify where your problem exactly is. Include error messages or a better description what is not working/the problem – Doluk Feb 01 '23 at 20:34
  • there is no error message i just cant find a way to convert my command with reactions to a slash command – CYKLER Feb 01 '23 at 20:57
  • well what did you try? Did you try reading through the [docs](https://discordpy.readthedocs.io/en/stable/interactions/api.html?highlight=application%20command#application-commands)? Or have a look at other stack overflow [questions](https://stackoverflow.com/questions/71165431/how-do-i-make-a-working-slash-command-in-discord-py)? Seems like you've done the barebones and just expect us to write the code for you which isn't the purpose of stack overflow. – ESloman Feb 02 '23 at 08:41
  • have you synced your commands on start up? Because the code seems fine, without having it tested. – Doluk Feb 03 '23 at 07:02

0 Answers0