From e015ca8ae8811794d2c2b05c28799fcd6b1c4ccc Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 17 Sep 2021 10:41:54 +0200 Subject: [PATCH] adding server count to the presence message --- src/main.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index bac5bc9..4264150 100644 --- a/src/main.py +++ b/src/main.py @@ -44,10 +44,21 @@ async def on_resumed(): print("Reconnecté !") @client.event -async def on_ready(): +async def on_ready(update_changePresence = False): """Triggered when the bot is ready to operate""" - await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = f"{customPrefix}help", type = discord.ActivityType.playing)) - print("Bot prêt.") + await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = f"{customPrefix}help · {len(client.guilds)} serveur{'s' if len(client.guilds) > 1 else ''}", type = discord.ActivityType.playing)) + if update_changePresence == False: + print("Bot prêt.") + +@client.event +async def on_guild_join(_): + """Triggered when the bot join a new guild""" + await on_ready(True) + +@client.event +async def on_guild_remove(_): + """Triggered when the bot left a guild""" + await on_ready(True) @client.event async def on_command_error(ctx, error):