mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 10:17:59 -05:00
Major dependency update (#1974)
* [V3] Stop `tmp` dir showing up * [V3] Remove requirements.txt and declare in install_requires * Remove requirements.txt from tox.ini * Update and pin all dependencies and sub-dependencies * Update for breaking changes * Reformat * Update docs/requirements.txt and tox.ini requirements * Add 3.7 to identifiers and travis/tox builds * Attempt at fixing the travis build matrix * Attempt #2 * Attempt 3 * aiohttp.ClientSession.close() -> detach() in sync code * Add raven-aiohttp to requirements * Fix stuff in setup.py - Added discord.py back into requirements list - Fix typo in alabaster extra requirement Also in the Pipfile: - Removed allow_prereleases and explicitly pinned black, since this is the only dep we want a prerelease for. * Update to Rapptz/discord.py@8ccb98d395 * Add proper 3.7 build in Travis See travis-ci/travis-ci#9815 * Which version of 3.6 does Xenial install then? * Maybe we should stop pipenv installing useless stuff * Nevermind, back to specific minor version * Remove lots of WET dependency stuff * Fix egg fragment for dependency link
This commit is contained in:
@@ -71,7 +71,9 @@ class Command(commands.Command):
|
||||
cmd = cmd.parent
|
||||
return sorted(entries, key=lambda x: len(x.qualified_name), reverse=True)
|
||||
|
||||
async def do_conversion(self, ctx: "Context", converter, argument: str):
|
||||
async def do_conversion(
|
||||
self, ctx: "Context", converter, argument: str, param: inspect.Parameter
|
||||
):
|
||||
"""Convert an argument according to its type annotation.
|
||||
|
||||
Raises
|
||||
@@ -90,14 +92,14 @@ class Command(commands.Command):
|
||||
return argument
|
||||
|
||||
try:
|
||||
return await super().do_conversion(ctx, converter, argument)
|
||||
return await super().do_conversion(ctx, converter, argument, param)
|
||||
except commands.BadArgument as exc:
|
||||
raise ConversionFailure(converter, argument, *exc.args) from exc
|
||||
raise ConversionFailure(converter, argument, param, *exc.args) from exc
|
||||
except ValueError as exc:
|
||||
# Some common converters need special treatment...
|
||||
if converter in (int, float):
|
||||
message = _('"{argument}" is not a number.').format(argument=argument)
|
||||
raise ConversionFailure(converter, argument, message) from exc
|
||||
raise ConversionFailure(converter, argument, param, message) from exc
|
||||
|
||||
# We should expose anything which might be a bug in the converter
|
||||
raise exc
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
"""Errors module for the commands package."""
|
||||
import inspect
|
||||
from discord.ext import commands
|
||||
|
||||
__all__ = ["ConversionFailure"]
|
||||
@@ -7,7 +8,8 @@ __all__ = ["ConversionFailure"]
|
||||
class ConversionFailure(commands.BadArgument):
|
||||
"""Raised when converting an argument fails."""
|
||||
|
||||
def __init__(self, converter, argument: str, *args):
|
||||
def __init__(self, converter, argument: str, param: inspect.Parameter, *args):
|
||||
self.converter = converter
|
||||
self.argument = argument
|
||||
self.param = param
|
||||
super().__init__(*args)
|
||||
|
||||
Reference in New Issue
Block a user