Merge V3/release/3.0.0 into V3/develop

This commit is contained in:
Toby Harradine
2019-01-28 15:30:30 +11:00
committed by GitHub
69 changed files with 21563 additions and 81 deletions

View File

@@ -148,5 +148,5 @@ class VersionInfo:
)
__version__ = "3.0.0rc3.post1"
__version__ = "3.0.0"
version_info = VersionInfo.from_str(__version__)

View File

@@ -500,7 +500,12 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin):
if result is not None:
hook_results.append(result)
if hook_results:
return all(hook_results)
if all(hook_results):
ctx.permission_state = commands.PermState.ALLOWED_BY_HOOK
return True
else:
ctx.permission_state = commands.PermState.DENIED_BY_HOOK
return False
class Red(RedBase, discord.AutoShardedClient):

View File

@@ -30,7 +30,7 @@ def interactive_config(red, token_set, prefix_set):
"\nPick a prefix. A prefix is what you type before a "
"command. Example:\n"
"!help\n^ The exclamation mark is the prefix in this case.\n"
"Can be multiple characters. You will be able to change it "
"The prefix can be multiple characters. You will be able to change it "
"later and add more of them.\nChoose your prefix:\n"
)
while not prefix:
@@ -51,7 +51,7 @@ def ask_sentry(red: Red):
loop = asyncio.get_event_loop()
print(
"\nThank you for installing Red V3! Red is constantly undergoing\n"
" improvements, and we would like ask if you are comfortable with\n"
" improvements, and we would like to ask if you are comfortable with\n"
" the bot automatically submitting fatal error logs to the development\n"
' team. If you wish to opt into the process please type "yes":\n'
)

View File

@@ -93,6 +93,10 @@ DM_PERMS.update(
class PrivilegeLevel(enum.IntEnum):
"""Enumeration for special privileges."""
# Maintainer Note: do NOT re-order these.
# Each privelege level also implies access to the ones before it.
# Inserting new privelege levels at a later point is fine if that is considered.
NONE = enum.auto()
"""No special privilege level."""
@@ -168,6 +172,17 @@ class PermState(enum.Enum):
chain.
"""
# The below are valid states, but should not be transitioned to
# They should be set if they apply.
ALLOWED_BY_HOOK = enum.auto()
"""This command has been actively allowed by a permission hook.
check validation doesn't need this, but is useful to developers"""
DENIED_BY_HOOK = enum.auto()
"""This command has been actively denied by a permission hook
check validation doesn't need this, but is useful to developers"""
def transition_to(
self, next_state: "PermState"
) -> Tuple[Optional[bool], Union["PermState", Dict[bool, "PermState"]]]: