wop commited on
Commit
abe125b
·
verified ·
1 Parent(s): 68da665

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -58,7 +58,16 @@ async def on_ready():
58
  print(f"Logged in as {bot.user} (ID: {bot.user.id})")
59
  event.set()
60
  print("------")
61
-
 
 
 
 
 
 
 
 
 
62
 
63
  @bot.event
64
  async def on_member_join(mb):
 
58
  print(f"Logged in as {bot.user} (ID: {bot.user.id})")
59
  event.set()
60
  print("------")
61
+ await update_status()
62
+
63
+ async def update_status():
64
+ while True:
65
+ # Fetch the number of members in all guilds the bot is connected to
66
+ member_count = sum(guild.member_count for guild in bot.guilds)
67
+ # Update the bot's status
68
+ await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{member_count} users"))
69
+ # Wait for 60 seconds before updating again
70
+ await asyncio.sleep(60)
71
 
72
  @bot.event
73
  async def on_member_join(mb):