[V3] Custom context class (#988)

* Create custom context class

* Documentation

* Remove old help method, replace with new

* Update from rebase
This commit is contained in:
Tobotimus
2017-10-16 12:02:51 +11:00
committed by Will
parent 36b3fbd5bc
commit 86b18c702c
14 changed files with 78 additions and 32 deletions

View File

@@ -10,8 +10,7 @@ from discord.ext import commands
from discord.ext.commands import GroupMixin
from .cog_manager import CogManager
from . import Config
from . import i18n
from . import Config, i18n, RedContext
class Red(commands.Bot):
@@ -84,15 +83,8 @@ class Red(commands.Bot):
return True
return await super().is_owner(user)
async def send_cmd_help(self, ctx):
if ctx.invoked_subcommand:
pages = await self.formatter.format_help_for(ctx, ctx.invoked_subcommand)
for page in pages:
await ctx.send(page)
else:
pages = await self.formatter.format_help_for(ctx, ctx.command)
for page in pages:
await ctx.send(page)
async def get_context(self, message, *, cls=RedContext):
return await super().get_context(message, cls=cls)
async def shutdown(self, *, restart=False):
"""Gracefully quits Red with exit code 0