From 2f051659ab3481fbf8a3b85513f5f4e11fe65708 Mon Sep 17 00:00:00 2001 From: Noah <117038300+NoahCxrest@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:10:26 -0700 Subject: [PATCH] Update erm.py --- erm.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/erm.py b/erm.py index b1f0c4e..45cf3e0 100644 --- a/erm.py +++ b/erm.py @@ -201,6 +201,7 @@ async def setup_hook(self) -> None: statistics_check.start() tempban_checks.start() check_whitelisted_car.start() + change_status.start() logging.info("Setup_hook complete! All tasks are now running!") async for document in self.views.db.find({}): @@ -220,9 +221,7 @@ async def setup_hook(self) -> None: setup = True -status_message = "⚡ /about | ermbot.xyz" - -bot = commands.Bot( +bot = Bot( command_prefix=get_prefix, case_insensitive=True, intents=intents, @@ -230,10 +229,7 @@ async def setup_hook(self) -> None: allowed_mentions=discord.AllowedMentions( replied_user=False, everyone=False, roles=False ), - activity=discord.CustomActivity(name=status_message), - status=discord.Status.online ) - bot.debug_servers = [987798554972143728] bot.is_synced = False bot.shift_management_disabled = False @@ -461,6 +457,17 @@ async def staff_field(bot: Bot, embed, query): mongo_url = "" +# status change discord.ext.tasks + + +@tasks.loop(hours=1) +async def change_status(): + await bot.wait_until_ready() + logging.info("Changing status") + status = "⚡ /about | ermbot.xyz" + await bot.change_presence( + activity=discord.CustomActivity(name=status) + ) @tasks.loop(minutes=1) async def check_reminders():