just wondering how an I have 2 arguments, for example
JavaScript
x
3
1
User: ?text A B
2
Bot: A B
3
Like “arg1” and “arg2” Example:
JavaScript
1
2
1
await bot.say({} {}.format(arg1, arg2))
2
Advertisement
Answer
For 2 args as 2 separate variables you could do something like this
JavaScript
1
4
1
@bot.command()
2
async def args(ctx, arg1, arg2):
3
await ctx.send('You sent {} and {}'.format(arg1, arg2))
4
Or if you want to send all args passed as a list you could do… as per the rewrite documentation:
JavaScript
1
4
1
@bot.command()
2
async def args(ctx, *args):
3
await ctx.send('`{}` arguments: `{}`'.format(len(args), ', '.join(args)))
4
Or if you want to send everything as one argument you could do (documentation):
JavaScript
1
4
1
@bot.command()
2
async def args(ctx, *, arg):
3
await ctx.send(arg)
4