fix conflicts
This commit is contained in:
@ -30,12 +30,11 @@ import inspect
|
||||
import importlib.util
|
||||
import sys
|
||||
import traceback
|
||||
import re
|
||||
import types
|
||||
|
||||
import discord
|
||||
|
||||
from .core import GroupMixin, Command
|
||||
from .core import GroupMixin
|
||||
from .view import StringView
|
||||
from .context import Context
|
||||
from . import errors
|
||||
|
@ -70,6 +70,11 @@ class CogMeta(type):
|
||||
-----------
|
||||
name: :class:`str`
|
||||
The cog name. By default, it is the name of the class with no modification.
|
||||
description: :class:`str`
|
||||
The cog description. By default, it is the cleaned docstring of the class.
|
||||
|
||||
.. versionadded:: 1.6
|
||||
|
||||
command_attrs: :class:`dict`
|
||||
A list of attributes to apply to every command inside this cog. The dictionary
|
||||
is passed into the :class:`Command` options at ``__init__``.
|
||||
@ -93,6 +98,11 @@ class CogMeta(type):
|
||||
attrs['__cog_name__'] = kwargs.pop('name', name)
|
||||
attrs['__cog_settings__'] = command_attrs = kwargs.pop('command_attrs', {})
|
||||
|
||||
description = kwargs.pop('description', None)
|
||||
if description is None:
|
||||
description = inspect.cleandoc(attrs.get('__doc__', ''))
|
||||
attrs['__cog_description__'] = description
|
||||
|
||||
commands = {}
|
||||
listeners = {}
|
||||
no_bot_cog = 'Commands or listeners must not start with cog_ or bot_ (in method {0.__name__}.{1})'
|
||||
@ -209,11 +219,11 @@ class Cog(metaclass=CogMeta):
|
||||
@property
|
||||
def description(self):
|
||||
""":class:`str`: Returns the cog's description, typically the cleaned docstring."""
|
||||
try:
|
||||
return self.__cog_cleaned_doc__
|
||||
except AttributeError:
|
||||
self.__cog_cleaned_doc__ = cleaned = inspect.getdoc(self)
|
||||
return cleaned
|
||||
return self.__cog_description__
|
||||
|
||||
@description.setter
|
||||
def description(self, description):
|
||||
self.__cog_description__ = description
|
||||
|
||||
def walk_commands(self):
|
||||
"""An iterator that recursively walks through this cog's commands and subcommands.
|
||||
@ -427,4 +437,7 @@ class Cog(metaclass=CogMeta):
|
||||
if cls.bot_check_once is not Cog.bot_check_once:
|
||||
bot.remove_check(self.bot_check_once, call_once=True)
|
||||
finally:
|
||||
self.cog_unload()
|
||||
try:
|
||||
self.cog_unload()
|
||||
except Exception:
|
||||
pass
|
||||
|
@ -333,27 +333,7 @@ class Context(discord.abc.Messageable):
|
||||
except CommandError as e:
|
||||
await cmd.on_help_command_error(self, e)
|
||||
|
||||
async def reply(self, content=None, **kwargs):
|
||||
"""|coro|
|
||||
|
||||
A shortcut method to :meth:`~discord.abc.Messageable.send` to reply to the
|
||||
:class:`~discord.Message` that invoked the command.
|
||||
|
||||
.. versionadded:: 1.5.1.5
|
||||
|
||||
Raises
|
||||
--------
|
||||
~discord.HTTPException
|
||||
Sending the message failed.
|
||||
~discord.Forbidden
|
||||
You do not have the proper permissions to send the message.
|
||||
~discord.InvalidArgument
|
||||
The ``files`` list is not of the appropriate size or
|
||||
you specified both ``file`` and ``files``.
|
||||
|
||||
Returns
|
||||
---------
|
||||
:class:`~discord.Message`
|
||||
The message that was sent.
|
||||
"""
|
||||
return await self.message.reply(content, **kwargs)
|
||||
async def reply(self, content=None, **kwargs):
|
||||
return await self.message.reply(content, **kwargs)
|
||||
|
||||
reply.__doc__ = discord.Message.reply.__doc__
|
||||
|
Reference in New Issue
Block a user