Bot only takes one command

Viewed 176

I'm trying to make a bot where when you type for example "!say hello world" and the bot would reply with "Hello World". But when I try to do spaces it doesn't work.

So when I simply type "!say Hello" it shows this:

As you can see it works fine but when I put a space for example "!say hello world" it shows this:

As you can see it only prints "Hello" and acts like I didn't say "World".

Here is my code:

@client.command()
async def say(ctx, arg):
    await ctx.send(arg)
1 Answers

See here: Commands

Since positional arguments are just regular Python arguments, you can have as many as you want:

@bot.command()
async def test(ctx, arg1, arg2):
    await ctx.send('You passed {} and {}'.format(arg1, arg2))

Sometimes you want users to pass in an undetermined number of parameters. The library supports this similar to how variable list parameters are done in Python:

@bot.command()
async def test(ctx, *args):
    await ctx.send('{} arguments: {}'.format(len(args), ', '.join(args)))
Related