Ask coding questions

← Back to all posts
Member count system discord.py
Coolboy62ksi (0)

Im looking to get my bot to do a server count as it already has i status so i want to status to change between my status and how many servers my bot is in i only have 1 file main.py

Comments
hotnewtop
SixBeeps (5221)

Use len(client.guilds) to get the number of servers the bot is in. Using that, update the bot's status every once in a while to show that amount. Something like this might work:

await bot.change_presence(activity=discord.Game(name=f'in {len(client.guilds)} servers'))
Coolboy62ksi (0)

Ive got a status set that tells people the bots commands how would i fit this into the status @SixBeeps

SixBeeps (5221)

@Coolboy62ksi Oh, you want it to oscillate between the two?

Coolboy62ksi (0)

That would be great yes i would @SixBeeps

SixBeeps (5221)

@Coolboy62ksi Hey, sorry I didn't see this 'till now. Yeah I have no clue how to do this in Python. Does your bot run an event loop?