1
votes

I am trying to build my first discord bot and I ran into what seems like a very simple error, however I can't seem to figure out what the problem is. I successfully made my bot report the latency back to the server, but I can't add a 'ms' statement after.

@b.command()
async def ping(ctx):
    latency = round(b.latency*1000)
    await ctx.send((latency),'ms')


error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: send() takes from 1 to 2 positional arguments but 3 were given

1
Try formatting your message text and just send the text - something like msg = str(latency) + 'ms', then await ctx.send(msg). The send doesn't handle the formatting of multiple items. - DaveStSomeWhere

1 Answers

-1
votes

As @DaveStSomeWhere said, the send doesn't handle the formatting of multiple items so all you had to do was this:

@b.command()
async def ping(ctx):
    latency = round(b.latency*1000)
    await ctx.send(f"{latency} ms")