Skip to content

Commit 55efe08

Browse files
committed
Fixed shit up and reply command
1 parent 3af7bd4 commit 55efe08

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

bot.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,15 @@ async def setup(self, ctx):
141141

142142
categ = await ctx.guild.create_category(name='modmail', overwrites=self.overwrites(ctx))
143143
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')
145146
await ctx.send('Successfully set up server.')
146147

147148
@commands.command(name='close')
148149
@commands.has_permissions(manage_guild=True)
149150
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.')
150153
user_id = int(ctx.channel.topic.split(': ')[1])
151154
user = self.get_user(user_id)
152155
await user.send('A moderator has closed this modmail session.')
@@ -261,11 +264,12 @@ async def on_message(self, message):
261264

262265
@commands.command()
263266
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)
265268
if categ is not None:
266269
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)
269273

270274
if __name__ == '__main__':
271275
Modmail.init()

0 commit comments

Comments
 (0)