Discord.py 봇 길드 수

Oct 15 2020

내 봇이있는 길드의 수를 확인하려고합니다. 이것은 내 현재 코드입니다.

@client.command()
async def servers(ctx):
    await ctx.send(f"{str(client.guilds)}")

하지만 봇은 [<Guild id=739683588408082462 name='Epic bot testing' shard_id=None chunked=True member_count=17>]어떻게이 문제를 해결할 수 있습니까?

답변

1 FurtherReading Oct 15 2020 at 07:35

client.guilds방금 변경, 그래서 길드의 목록 strlen이 목록의 길이를 얻을 수 있습니다.

@client.command()
async def servers(ctx):
    await ctx.send(f"{len(client.guilds)}")