|
24 | 24 |
|
25 | 25 | __version__ = '1.3.7' |
26 | 26 |
|
27 | | -import discord |
28 | | -from discord.ext import commands |
29 | | -import aiohttp |
| 27 | +from contextlib import redirect_stdout |
30 | 28 | from urllib.parse import urlparse |
| 29 | +from copy import deepcopy |
31 | 30 | import asyncio |
32 | 31 | import textwrap |
| 32 | +import traceback |
33 | 33 | import datetime |
| 34 | +import inspect |
| 35 | +import string |
34 | 36 | import time |
35 | 37 | import json |
36 | | -import sys |
37 | 38 | import os |
38 | 39 | import re |
39 | | -import string |
40 | | -import traceback |
41 | 40 | import io |
42 | | -import inspect |
43 | | -from contextlib import redirect_stdout |
| 41 | + |
| 42 | +import discord |
| 43 | +from discord.ext import commands |
| 44 | +from paginator import PaginatorSession |
| 45 | +import aiohttp |
| 46 | + |
44 | 47 |
|
45 | 48 | class Github: |
46 | 49 | head = 'https://api.github.com/repos/kyb3r/modmail/git/refs/heads/master' |
@@ -206,13 +209,12 @@ def overwrites(self, ctx, modrole=None): |
206 | 209 | def help_embed(self, prefix): |
207 | 210 | em = discord.Embed(color=0x00FFFF) |
208 | 211 | em.set_author(name='Mod Mail - Help', icon_url=self.user.avatar_url) |
209 | | - em.description = 'This bot is a python implementation of a "Mod Mail" bot. ' \ |
210 | | - 'Made by kyb3r and improved by the suggestions of others.' |
| 212 | + em.description = 'Here is a list of commands for the bot.' |
211 | 213 |
|
212 | 214 | cmds = f'`{prefix}setup` - Sets up the categories that will be used by the bot.\n' \ |
213 | 215 | f'`{prefix}about` - Shows general information about the bot.\n' \ |
214 | 216 | f'`{prefix}contact` - Allows a moderator to initiate a thread with a given recipient.\n' \ |
215 | | - f'`{prefix}reply <message...>` - Sends a message to the current thread\'s recipient.\n' \ |
| 217 | + f'`{prefix}reply` - Sends a message to the current thread\'s recipient.\n' \ |
216 | 218 | f'`{prefix}close` - Closes the current thread and deletes the channel.\n' \ |
217 | 219 | f'`{prefix}archive` - Closes the thread and moves the channel to archive category.\n' \ |
218 | 220 | f'`{prefix}block` - Blocks a user from using modmail.\n' \ |
@@ -244,7 +246,7 @@ def help_embed(self, prefix): |
244 | 246 | em.add_field(name='Custom Mentions', value=mention) |
245 | 247 | em.add_field(name='Warning', value=warn) |
246 | 248 | em.add_field(name='Github', value='https://github.com/kyb3r/modmail') |
247 | | - em.set_footer(text=f'Modmail v{__version__} | Star the repository to unlock hidden features! /s') |
| 249 | + em.set_footer(text=f'modmail v{__version__} • A star on the repository is appreciated.') |
248 | 250 |
|
249 | 251 | return em |
250 | 252 |
|
@@ -283,8 +285,16 @@ def uptime(self): |
283 | 285 | @commands.command() |
284 | 286 | async def help(self, ctx): |
285 | 287 | prefix = self.config.get('PREFIX', 'm.') |
286 | | - em = self.help_embed(prefix) |
287 | | - await ctx.send(embed=em) |
| 288 | + |
| 289 | + em1 = self.help_embed(prefix) |
| 290 | + em2 = deepcopy(em1) |
| 291 | + em1.set_footer(text=f'modmail v{__version__}') |
| 292 | + em2.description = None |
| 293 | + em2.remove_field(0) |
| 294 | + em1._fields = em1._fields[0:1] |
| 295 | + |
| 296 | + session = PaginatorSession(ctx, em1, em2) |
| 297 | + await session.run() |
288 | 298 |
|
289 | 299 | @commands.command() |
290 | 300 | async def about(self, ctx): |
@@ -391,16 +401,28 @@ async def setup(self, ctx, *, modrole: discord.Role=None): |
391 | 401 | @commands.has_permissions(manage_messages=True) |
392 | 402 | async def _snippets(self, ctx): |
393 | 403 | '''Returns a list of snippets that are currently set.''' |
| 404 | + embeds = [] |
| 405 | + |
394 | 406 | em = discord.Embed(color=discord.Color.green()) |
395 | 407 | em.set_author(name='Snippets', icon_url=ctx.guild.icon_url) |
396 | | - first_line = 'Here is a list of snippets that are currently configured. ' |
| 408 | + |
| 409 | + embeds.append(em) |
| 410 | + |
| 411 | + em.description = 'Here is a list of snippets that are currently configured.' |
| 412 | + |
397 | 413 | if not self.snippets: |
398 | | - first_line = 'You dont have any snippets at the moment. ' |
399 | | - em.description = first_line + 'You can add snippets by adding config variables in the form' \ |
400 | | - ' **`SNIPPET_{NAME}`**' |
| 414 | + em.color = discord.Color.red() |
| 415 | + em.description = 'You dont have any snippets at the moment.' |
| 416 | + |
401 | 417 | for name, value in self.snippets.items(): |
| 418 | + if len(em.fields) == 5: |
| 419 | + em = discord.Embed(color=discord.Color.green(), description=em.description) |
| 420 | + em.set_author(name='Snippets', icon_url=ctx.guild.icon_url) |
| 421 | + embeds.append(em) |
402 | 422 | em.add_field(name=name, value=value, inline=False) |
403 | | - await ctx.send(embed=em) |
| 423 | + |
| 424 | + session = PaginatorSession(ctx, *embeds) |
| 425 | + await session.run() |
404 | 426 |
|
405 | 427 | @commands.command() |
406 | 428 | @commands.has_permissions(administrator=True) |
|
0 commit comments