Discord.py Not showing how many servers it is in

Viewed 46

My code:

@bot.command()
async def servers(ctx):
  await ctx.send( f"I'm in {str(len(client.guilds))} servers")

When I use the command it says: I'm in 0 servers, but it's not in 0 servers.

1 Answers

I tried your code.

There is no error in this code and it runs as it should be. I tried this code:

With str()

@bot.command()
async def servers(ctx):
  await ctx.send( f"I'm in {str(len(client.guilds))} servers")

Withour str()

@bot.command()
async def servers(ctx):
  await ctx.send( f"I'm in {len(client.guilds)} servers")

The image below shows how it was executed: No Error!


I would like to see your whole code first.

Thank You! :)

Related