Merge pull request #4 from rejnronuzz/dev

fix startup freezing
This commit was merged in pull request #4.
This commit is contained in:
2026-03-09 14:47:30 +05:00
committed by GitHub
2 changed files with 9 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ from discord.ext import commands
import config
from utils.data_manager import save_message_id, load_message_id
import logging
import asyncio
logger = logging.getLogger(__name__)
@@ -20,7 +21,9 @@ class RoleManager(commands.Cog):
logger.info("Initialized role message with id: %s", self.role_message_id)
else:
logger.info("No role message found")
asyncio.ensure_future(self._startup())
async def _startup(self):
await self.bot.wait_until_ready()
if self.role_message_id:
await self.check_and_sync_roles()

View File

@@ -4,6 +4,7 @@ import json
import random
import logging
from typing import Optional
import asyncio
logger = logging.getLogger(__name__)
@@ -18,8 +19,12 @@ class StatusRotator(commands.Cog):
async def cog_load(self):
await self.load_statuses()
self.rotate_status.start()
logger.info("Status rotator initialized with %d statuses", len(self.statuses))
asyncio.ensure_future(self._startup())
async def _startup(self):
await self.bot.wait_until_ready()
self.rotate_status.start()
async def cog_unload(self):
self.rotate_status.cancel()