This repository was archived by the owner on Nov 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfo.py
More file actions
39 lines (33 loc) · 1.25 KB
/
info.py
File metadata and controls
39 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from discord.ext import commands
import discord
import inspect
import re
import io
import contextlib
import traceback
from paginator import *
import utils
from simplepaginator import SimplePaginator
class Info(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name='help')
async def _help(self, ctx, *, command: str = None):
"""Shows help about a command or the bot"""
try:
if command is None:
p = await HelpPaginator.from_bot(ctx)
else:
entity = self.bot.get_cog(command) or self.bot.get_command(command)
if entity is None:
clean = command.replace('@', '@\u200b')
return await ctx.send(f'Command or category "{clean}" not found.')
elif isinstance(entity, commands.Command):
p = await HelpPaginator.from_command(ctx, entity)
else:
p = await HelpPaginator.from_cog(ctx, entity)
await p.paginate()
except Exception as e:
await ctx.send("```" + "\n".join(traceback.format_exception(None, e, e.__traceback__)) + "```")
def setup(bot):
bot.add_cog(Info(bot))