-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V3] Send meaningful responses on conversion failure #1817
Changes from all commits
1fca876
7280a2f
490020d
3071696
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from .alias import Alias | ||
from discord.ext import commands | ||
from redbot.core.bot import Red | ||
|
||
|
||
def setup(bot: commands.Bot): | ||
def setup(bot: Red): | ||
bot.add_cog(Alias(bot)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,13 @@ | |
import functools | ||
import os | ||
import pkgutil | ||
import shutil | ||
from concurrent.futures import ThreadPoolExecutor | ||
from pathlib import Path | ||
from subprocess import run as sp_run, PIPE | ||
from sys import executable | ||
from typing import Tuple, MutableMapping, Union | ||
|
||
from discord.ext import commands | ||
|
||
from redbot.core import Config | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JSYK the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The commands import is used for type hinting, did you account for that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The commands import is replaced by |
||
from redbot.core import data_manager | ||
from redbot.core import data_manager, commands | ||
from redbot.core.utils import safe_delete | ||
from .errors import * | ||
from .installable import Installable, InstallableType | ||
|
@@ -232,7 +228,7 @@ async def current_commit(self, branch: str = None) -> str: | |
---------- | ||
branch : `str`, optional | ||
Override for repo's branch attribute. | ||
|
||
Returns | ||
------- | ||
str | ||
|
@@ -381,7 +377,7 @@ async def install_libraries( | |
Directory to install shared libraries to. | ||
libraries : `tuple` of `Installable` | ||
A subset of available libraries. | ||
|
||
Returns | ||
------- | ||
bool | ||
|
@@ -403,7 +399,7 @@ async def install_libraries( | |
|
||
async def install_requirements(self, cog: Installable, target_dir: Path) -> bool: | ||
"""Install a cog's requirements. | ||
|
||
Requirements will be installed via pip directly into | ||
:code:`target_dir`. | ||
|
||
|
@@ -465,7 +461,7 @@ async def install_raw_requirements(self, requirements: Tuple[str], target_dir: P | |
@property | ||
def available_cogs(self) -> Tuple[Installable]: | ||
"""`tuple` of `installable` : All available cogs in this Repo. | ||
|
||
This excludes hidden or shared packages. | ||
""" | ||
# noinspection PyTypeChecker | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from discord.ext import commands | ||
from redbot.core import commands | ||
import discord | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
from discord.ext.commands import * | ||
from .commands import * | ||
from .context import * | ||
from .errors import * |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Errors module for the commands package.""" | ||
from discord.ext import commands | ||
|
||
__all__ = ["ConversionFailure"] | ||
|
||
|
||
class ConversionFailure(commands.BadArgument): | ||
"""Raised when converting an argument fails.""" | ||
|
||
def __init__(self, converter, argument: str, *args): | ||
self.converter = converter | ||
self.argument = argument | ||
super().__init__(*args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import was unused