@@ -132,6 +132,22 @@ def overwrites(self, ctx):
132
132
133
133
return overwrites
134
134
135
+ def help_embed (self ):
136
+ em = discord .Embed (color = 0x00FFFF )
137
+ em .set_author (name = 'Mod Mail - Help' , icon_url = self .user .avatar_url )
138
+ em .description = 'This bot is a python implementation of a stateless "Mod Mail" bot. ' \
139
+ 'Made by verixx and improved by the suggestions of others. This bot saves no data and utilises channel topics for storage and syncing.'
140
+ cmds = '`m.setup [modrole] <- (optional)` - Command that sets up the bot.\n ' \
141
+ '`m.reply <message...>` - Sends a message to the current thread\' s recipient.\n ' \
142
+ '`m.close` - Closes the current thread and deletes the channel.\n ' \
143
+ '`m.disable` - Closes all threads and disables modmail for the server.'
144
+
145
+ warn = 'Do not manually delete the category or channels as it will break the system. Modifying the channel topic will also break the system.'
146
+ em .add_field (name = 'Commands' , value = cmds )
147
+ em .add_field (name = 'Warning' , value = warn )
148
+
149
+ return em
150
+
135
151
@commands .command ()
136
152
@commands .has_permissions (administrator = True )
137
153
async def setup (self , ctx ):
@@ -141,8 +157,29 @@ async def setup(self, ctx):
141
157
142
158
categ = await ctx .guild .create_category (name = 'modmail' , overwrites = self .overwrites (ctx ))
143
159
await categ .edit (position = 0 )
160
+ c = await ctx .guild .create_text_channel (name = 'information' , category = categ )
161
+ await c .send (embed = self .help_embed ())
144
162
await ctx .send ('Successfully set up server.' )
145
163
164
+ @commands .command ()
165
+ @commands .has_permissions (administrator = True )
166
+ async def disable (self , ctx ):
167
+ '''Close all threads and disable modmail.'''
168
+ categ = discord .utils .get (ctx .guild .categories , name = 'modmail' )
169
+ if not categ :
170
+ return await ctx .send ('This server is not set up.' )
171
+ for category , channels in ctx .guild .by_category ():
172
+ if category == categ :
173
+ for chan in channels :
174
+ if 'User ID:' in str (chan .topic ):
175
+ user_id = int (chan .topic .split (': ' )[1 ])
176
+ user = self .get_user (user_id )
177
+ await user .send ('A moderator has closed this modmail session.' )
178
+ await chan .delete ()
179
+ await categ .delete ()
180
+ await ctx .send ('Disabled modmail.' )
181
+
182
+
146
183
@commands .command (name = 'close' )
147
184
@commands .has_permissions (manage_guild = True )
148
185
async def _close (self , ctx ):
0 commit comments