[V3 permissions] command usage consistency (#1905)

* make the default rule settings consistent with the rest

* update docs to match new behavior
This commit is contained in:
Michael H
2018-07-11 22:09:28 -04:00
committed by Kowlin
parent 2df282222f
commit 6c1ee096a1
3 changed files with 24 additions and 20 deletions

View File

@@ -27,3 +27,18 @@ class RuleType(commands.Converter):
raise commands.BadArgument(
'"{arg}" is not a valid rule. Valid rules are "allow" or "deny"'.format(arg=arg)
)
class ClearableRuleType(commands.Converter):
async def convert(self, ctx: commands.Context, arg: str) -> str:
if arg.lower() in ("allow", "whitelist", "allowed"):
return "allow"
if arg.lower() in ("deny", "blacklist", "denied"):
return "deny"
if arg.lower() in ("clear", "reset"):
return "clear"
raise commands.BadArgument(
'"{arg}" is not a valid rule. Valid rules are "allow" or "deny", or "clear" to remove the rule'
"".format(arg=arg)
)