diff options
| author | 2019-09-14 14:18:39 +0200 | |
|---|---|---|
| committer | 2019-09-14 14:18:39 +0200 | |
| commit | b103fc0d5fb16122271a77db99f01a6b86175994 (patch) | |
| tree | 87c928b38fb8b0297a5bd6687eacf36a89185f70 | |
| parent | Adds a !nominees alias. (diff) | |
We now also detect bot tokens outside quotes.
Previously, the regex to detect tokens would only trigger on
messages where the token was inside of single or double quotes.
This commit changes this so that we look for bot tokens regardless
of context.
| -rw-r--r-- | bot/cogs/token_remover.py | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/bot/cogs/token_remover.py b/bot/cogs/token_remover.py index 05298a2ff..b2c4cd522 100644 --- a/bot/cogs/token_remover.py +++ b/bot/cogs/token_remover.py @@ -26,13 +26,11 @@ DELETION_MESSAGE_TEMPLATE = ( DISCORD_EPOCH_TIMESTAMP = datetime(2017, 1, 1) TOKEN_EPOCH = 1_293_840_000 TOKEN_RE = re.compile( - r"(?<=(\"|'))" # Lookbehind: Only match if there's a double or single quote in front r"[^\s\.]+" # Matches token part 1: The user ID string, encoded as base64 r"\." # Matches a literal dot between the token parts r"[^\s\.]+" # Matches token part 2: The creation timestamp, as an integer r"\." # Matches a literal dot between the token parts r"[^\s\.]+" # Matches token part 3: The HMAC, unused by us, but check that it isn't empty - r"(?=(\"|'))" # Lookahead: Only match if there's a double or single quote after ) |