refactor: Move on_ready event definition to a more appropriate location and restore logging functionality

This commit is contained in:
Ching L 2025-03-13 16:35:44 +08:00
parent 49843ba4d2
commit cceb927ead

View File

@ -27,10 +27,6 @@ logger.info('start bot')
# bot = discord.Bot(proxy='http://127.0.0.1:1235') # bot = discord.Bot(proxy='http://127.0.0.1:1235')
bot = discord.Bot() bot = discord.Bot()
@bot.event
async def on_ready():
logger.info(f"We have logged in as {bot.user}")
channel_id = 1152167937852055552 channel_id = 1152167937852055552
@tasks.loop(minutes=1) @tasks.loop(minutes=1)
@ -167,6 +163,8 @@ async def before_check_rank_changes():
@bot.event @bot.event
async def on_ready(): async def on_ready():
logger.info(f"We have logged in as {bot.user}")
channel = bot.get_channel(channel_id) channel = bot.get_channel(channel_id)
send_message.start(channel) send_message.start(channel)
heartbeat.start() heartbeat.start()