Search code examples
pythonvariablesdiscorddiscord.py

How do I make 2 random choice variables in one line? (discord.py)


Just keeps on saying

  await ctx.send("{}:".format(random.choice(a_var1)), "{}:".format(random.choice(a_var1)))
    TypeError: send() takes from 1 to 2 positional arguments but 3 were given
@bot.command(pass_context=True)
    async def a_message(ctx):
        a_var1 = [
            "a1",
            "a2",]
        a_var2 = [
            "b1",
            "b2",]
        await ctx.send("{}:".format(random.choice(a_var1)), "{}:".format(random.choice(a_var2)))

Like, how do you make it say "a1:b2", Instead of only "a1". If anybody could help me, that would much appreicated!


Solution

  • You should concatenate the strings. You are passing them as arguments.

    You can use

    ctx.send("{}:".format(random.choice(a_var1)) + "{}:".format(random.choice(a_var2)))