[V3] Send meaningful responses on conversion failure (#1817)

* [V3] Send meaningful responses on conversion failures

* Replace existing `discord.ext.commands` imports

Just to be sure

* Better Permissions converter response
This commit is contained in:
Tobotimus
2018-06-09 11:20:40 +10:00
committed by Will
parent d0a53ed2df
commit 033d0113a5
15 changed files with 82 additions and 26 deletions

View File

@@ -1,9 +1,8 @@
from typing import Tuple
import discord
from discord.ext import commands
from redbot.core import Config, checks
from redbot.core import Config, checks, commands
import logging

View File

@@ -1,7 +1,7 @@
import asyncio
import discord
from discord.ext import commands
from redbot.core import commands
class Announcer:

View File

@@ -1,5 +1,5 @@
import discord
from discord.ext import commands
from redbot.core import commands
class MemberDefaultAuthor(commands.Converter):

View File

@@ -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))

View File

@@ -5,7 +5,7 @@ import logging
from .audio import Audio
from .manager import start_lavalink_server
from discord.ext import commands
from redbot.core import commands
from redbot.core.data_manager import cog_data_path
import redbot.core

View File

@@ -1,6 +1,5 @@
import discord
from discord.ext import commands
from .repo_manager import RepoManager
from redbot.core import commands
from .installable import Installable

View File

@@ -2,17 +2,13 @@ import asyncio
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
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 @@ class Repo(RepoJSONMixin):
----------
branch : `str`, optional
Override for repo's branch attribute.
Returns
-------
str
@@ -381,7 +377,7 @@ class Repo(RepoJSONMixin):
Directory to install shared libraries to.
libraries : `tuple` of `Installable`
A subset of available libraries.
Returns
-------
bool
@@ -403,7 +399,7 @@ class Repo(RepoJSONMixin):
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 @@ class Repo(RepoJSONMixin):
@property
def available_cogs(self) -> Tuple[Installable]:
"""`tuple` of `installable` : All available cogs in this Repo.
This excludes hidden or shared packages.
"""
# noinspection PyTypeChecker

View File

@@ -1,4 +1,4 @@
from discord.ext import commands
from redbot.core import commands
import discord

View File

@@ -11,7 +11,10 @@ class CogOrCommand(commands.Converter):
if ret:
return "commands", ret.qualified_name
raise commands.BadArgument()
raise commands.BadArgument(
'Cog or command "{arg}" not found. Please note that this is case sensitive.'
"".format(arg=arg)
)
class RuleType(commands.Converter):
@@ -21,4 +24,6 @@ class RuleType(commands.Converter):
if arg.lower() in ("deny", "blacklist", "denied"):
return "deny"
raise commands.BadArgument()
raise commands.BadArgument(
'"{arg}" is not a valid rule. Valid rules are "allow" or "deny"'.format(arg=arg)
)

View File

@@ -2,7 +2,7 @@
from collections import Counter
import yaml
import discord
from discord.ext import commands
from redbot.core import commands
from redbot.ext import trivia as ext_trivia
from redbot.core import Config, checks
from redbot.core.data_manager import cog_data_path