@@ -35,6 +35,7 @@ def __init__(self, manager: 'ThreadManager',
3535 self ._id = recipient .id
3636 self ._recipient = recipient
3737 self ._channel = channel
38+ self .genesis_message = None
3839 self ._ready_event = asyncio .Event ()
3940 self ._close_task = None
4041
@@ -80,6 +81,8 @@ def ready(self, flag):
8081 async def setup (self , * , creator = None , category = None ):
8182 """Create the thread channel and other io related initialisation tasks"""
8283
84+ self .bot .dispatch ('thread_create' , self )
85+
8386 recipient = self .recipient
8487
8588 # in case it creates a channel outside of category
@@ -124,17 +127,19 @@ async def setup(self, *, creator=None, category=None):
124127 else :
125128 mention = self .bot .config .get ('mention' , '@here' )
126129
127- async def send_info_embed ():
130+ async def send_genesis_message ():
128131 try :
129132 msg = await channel .send (mention , embed = info_embed )
130- await msg .pin ()
133+ self .bot .loop .create_task (msg .pin ())
134+ self .genesis_message = msg
131135 except :
132136 pass
137+ finally :
138+ self .ready = True
139+ self .bot .dispatch ('thread_ready' , self )
133140
134141 await channel .edit (topic = topic )
135- self .bot .loop .create_task (send_info_embed ())
136-
137- self .ready = True
142+ self .bot .loop .create_task (send_genesis_message ())
138143
139144 # Once thread is ready, tell the recipient.
140145 thread_creation_response = self .bot .config .get (
0 commit comments