@@ -160,25 +160,19 @@ def __init__(self, bot: Red):
160160 partial (AntiSpam , self .intervals )
161161 )
162162 self .dynamic_ready : Final [Dict [int , asyncio .Event ]] = {}
163- self .cog_ready : Final = asyncio .Event ()
164- asyncio .create_task (self .initialize ())
165163
166- async def initialize (self ):
164+ async def cog_load (self ):
167165 self .cache .update (await self .config .all_guilds ())
168166 # Default channels before discord removed them shared their IDs with their guild,
169167 # which would theoretically cause a key conflict here. However,
170168 # default channels are text channels and these are everything but.
171169 self .cache .update (await self .config .all_channels ())
172- self .cog_ready .set ()
173170
174171 @staticmethod
175172 def _defaults () -> Settings :
176173 # using __annotations__ directly here since we don't need to eval the annotations
177174 return cast (Settings , dict .fromkeys (Settings .__annotations__ .keys (), None ))
178175
179- async def cog_before_invoke (self , ctx : commands .Context ) -> None :
180- await self .cog_ready .wait ()
181-
182176 @commands .group ()
183177 @commands .guild_only ()
184178 @commands .admin_or_permissions (manage_guild = True )
@@ -310,7 +304,6 @@ async def on_guild_channel_create(self, vc: discord.abc.GuildChannel):
310304 return
311305 if await self .bot .cog_disabled_in_guild (self , guild ):
312306 return
313- await self .cog_ready .wait ()
314307 chain = Chain .from_scope (vc , self .cache )
315308 if not chain ["dynamic" ]:
316309 return
@@ -406,7 +399,6 @@ async def on_guild_channel_delete(self, vc):
406399 if not isinstance (vc , GuildVoiceTypes ):
407400 return
408401 guild = vc .guild
409- await self .cog_ready .wait ()
410402 await self .config .channel (vc ).clear ()
411403 chain = Chain .from_scope (vc , self .cache )
412404 try :
@@ -433,7 +425,6 @@ async def on_voice_state_update(
433425 if await self .bot .cog_disabled_in_guild (self , m .guild ):
434426 return
435427 LOG .debug ("on_voice_state_update(%s, %s, %s)" , m , b , a )
436- await self .cog_ready .wait ()
437428 role_set : Set [int ] = set (m ._roles )
438429 channel_updates : Dict [int , Optional [discord .PermissionOverwrite ]] = {}
439430 if b .channel != a .channel and b .channel :
0 commit comments