fix startup freezing #4
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user