From 44336e5ff0fe02bbea85b40943c7bfb696a6170c Mon Sep 17 00:00:00 2001 From: Ching L Date: Thu, 13 Mar 2025 16:35:44 +0800 Subject: [PATCH] refactor: Move on_ready event definition to a more appropriate location and restore logging functionality --- discord_bot.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/discord_bot.py b/discord_bot.py index 42c6579..6cb6cc5 100644 --- a/discord_bot.py +++ b/discord_bot.py @@ -27,10 +27,6 @@ logger.info('start bot') # bot = discord.Bot(proxy='http://127.0.0.1:1235') bot = discord.Bot() -@bot.event -async def on_ready(): - logger.info(f"We have logged in as {bot.user}") - channel_id = 1152167937852055552 @tasks.loop(minutes=1) @@ -167,6 +163,8 @@ async def before_check_rank_changes(): @bot.event async def on_ready(): + logger.info(f"We have logged in as {bot.user}") + channel = bot.get_channel(channel_id) send_message.start(channel) heartbeat.start()