Slash Commands Option

I want to set-up a command where the person can type /say hello and the bot will respond with a message but this isn’t working?

@sayhi.tree.command(name="chicken hello")
async def sayhi(interaction: discord.Interaction):
  await interaction.response.send_message(f'Hi {interaction.user.mention}! Would you like a drink?', ephemeral=True)

It has a problem with the fact I’ve got a space between “chicken” and “hello” but I don’t want just “chicken” because I’d like to create other responses it could do like /chicken goodbye

Any ideas?

Hello @colourfulconnor!

I’m not sure if this is related, but Discord commands cannot have spaces in them, so instead, your code snippet would be:

@sayhi.tree.command(name="chicken-hello")
async def sayhi(interaction: discord.Interaction):
  await interaction.response.send_message(f'Hi {interaction.user.mention}! Would you like a drink?', ephemeral=True)

Use app_commands.Group.
you can find examples on GitHub:

2 Likes