@@ -35,6 +35,7 @@ def __init__(self, manager: 'ThreadManager',
35
35
self ._id = recipient .id
36
36
self ._recipient = recipient
37
37
self ._channel = channel
38
+ self .genesis_message = None
38
39
self ._ready_event = asyncio .Event ()
39
40
self ._close_task = None
40
41
@@ -80,6 +81,8 @@ def ready(self, flag):
80
81
async def setup (self , * , creator = None , category = None ):
81
82
"""Create the thread channel and other io related initialisation tasks"""
82
83
84
+ self .bot .dispatch ('thread_create' , self )
85
+
83
86
recipient = self .recipient
84
87
85
88
# in case it creates a channel outside of category
@@ -124,17 +127,19 @@ async def setup(self, *, creator=None, category=None):
124
127
else :
125
128
mention = self .bot .config .get ('mention' , '@here' )
126
129
127
- async def send_info_embed ():
130
+ async def send_genesis_message ():
128
131
try :
129
132
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
131
135
except :
132
136
pass
137
+ finally :
138
+ self .ready = True
139
+ self .bot .dispatch ('thread_ready' , self )
133
140
134
141
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 ())
138
143
139
144
# Once thread is ready, tell the recipient.
140
145
thread_creation_response = self .bot .config .get (
0 commit comments