aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-10 20:40:35 -0400
committerRapptz <[email protected]>2016-06-10 20:40:35 -0400
commit74cfc53bc82088e8ea2638d38fd03059d7169057 (patch)
treef1b024a1cd81155dabcb4cbc0dd7e4da06e9ad87
parent[commands] Exceptions raised while invocation raise CommandInvokeError. (diff)
downloaddiscord.py-74cfc53bc82088e8ea2638d38fd03059d7169057.tar.xz
discord.py-74cfc53bc82088e8ea2638d38fd03059d7169057.zip
[commands] Make it so CommandError does not contain @everyone mentions.
Mitigates some permission elevation issues.
-rw-r--r--discord/ext/commands/errors.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/discord/ext/commands/errors.py b/discord/ext/commands/errors.py
index 7ba0285e..c53da8b5 100644
--- a/discord/ext/commands/errors.py
+++ b/discord/ext/commands/errors.py
@@ -39,7 +39,10 @@ class CommandError(DiscordException):
in a special way as they are caught and passed into a special event
from :class:`Bot`\, :func:`on_command_error`.
"""
- pass
+ def __init__(self, message):
+ # clean-up @everyone and @here mentions
+ m = message.replace('@everyone', '@\u200beveryone').replace('@here', '@\u200bhere')
+ super().__init__(m)
class CommandNotFound(CommandError):
"""Exception raised when a command is attempted to be invoked
@@ -48,6 +51,7 @@ class CommandNotFound(CommandError):
This is not raised for invalid subcommands, rather just the
initial main command that is attempted to be invoked.
"""
+ pass
class MissingRequiredArgument(CommandError):
"""Exception raised when parsing a command and a parameter