Search code examples
pythondiscordbots

Discord bot command options


I have problem with my bot

@bot.command()
async def test(ctx, *, arg):
    await ctx.send(arg)

When I type '/test some text', the console say

return await coro(ctx, *args, **kwargs)

TypeError: test() missing 1 required keyword-only argument: 'arg'

Can somebody explain it ?

I want to create /test command with one option to choose in that case '/test option to chosee and type in option some text' then bot reply text that I put in option


Solution

  • This might help you.

    @bot.command()
    async def say(interaction: discord.Interaction, word:str):
        await interaction.response.send_message(word)
    

    You need to put the variable reference in the define function if it's str do string:str if it's int you can use number:int