@@ -141,12 +141,15 @@ async def setup(self, ctx):
141
141
142
142
categ = await ctx .guild .create_category (name = 'modmail' , overwrites = self .overwrites (ctx ))
143
143
await categ .edit (position = 0 )
144
- await ctx .guild .create_text_channel (name = 'discussion' , category = categ )
144
+ c = await ctx .guild .create_text_channel (name = 'discussion' , category = categ )
145
+ await c .edit (topic = 'DO NOT CHANGE THE CATEGORY NAME OR THE BOT WILL BREAK' )
145
146
await ctx .send ('Successfully set up server.' )
146
147
147
148
@commands .command (name = 'close' )
148
149
@commands .has_permissions (manage_guild = True )
149
150
async def _close (self , ctx ):
151
+ if 'User ID:' not in ctx .channel .topic :
152
+ return await ctx .send ('This is not a modmail thread.' )
150
153
user_id = int (ctx .channel .topic .split (': ' )[1 ])
151
154
user = self .get_user (user_id )
152
155
await user .send ('A moderator has closed this modmail session.' )
@@ -261,11 +264,12 @@ async def on_message(self, message):
261
264
262
265
@commands .command ()
263
266
async def reply (self , ctx , * , msg ):
264
- categ = discord .utils .get (ctx .message . guild .categories , id = ctx . message .channel .category_id )
267
+ categ = discord .utils .get (ctx .guild .categories , id = ctx .channel .category_id )
265
268
if categ is not None :
266
269
if categ .name == 'modmail' :
267
- ctx .message .content = msg
268
- await self .process_reply (ctx .message )
270
+ if 'User ID:' in ctx .channel .topic :
271
+ ctx .message .content = msg
272
+ await self .process_reply (ctx .message )
269
273
270
274
if __name__ == '__main__' :
271
275
Modmail .init ()
0 commit comments