@@ -34,6 +34,7 @@ def __init__(self, manager: 'ThreadManager',
3434 self ._id = recipient .id
3535 self ._recipient = recipient
3636 self ._channel = channel
37+ self .genesis_message = None
3738 self ._ready_event = asyncio .Event ()
3839 self ._close_task = None
3940
@@ -79,6 +80,8 @@ def ready(self, flag: bool):
7980 async def setup (self , * , creator = None , category = None ):
8081 """Create the thread channel and other io related initialisation tasks"""
8182
83+ self .bot .dispatch ('thread_create' , self )
84+
8285 recipient = self .recipient
8386
8487 # in case it creates a channel outside of category
@@ -123,17 +126,19 @@ async def setup(self, *, creator=None, category=None):
123126 else :
124127 mention = self .bot .config .get ('mention' , '@here' )
125128
126- async def send_info_embed ():
129+ async def send_genesis_message ():
127130 try :
128131 msg = await channel .send (mention , embed = info_embed )
129- await msg .pin ()
132+ self .bot .loop .create_task (msg .pin ())
133+ self .genesis_message = msg
130134 except :
131135 pass
136+ finally :
137+ self .ready = True
138+ self .bot .dispatch ('thread_ready' , self )
132139
133140 await channel .edit (topic = topic )
134- self .bot .loop .create_task (send_info_embed ())
135-
136- self .ready = True
141+ self .bot .loop .create_task (send_genesis_message ())
137142
138143 # Once thread is ready, tell the recipient.
139144 thread_creation_response = self .bot .config .get (
0 commit comments