aboutsummaryrefslogtreecommitdiffstats
path: root/bot/cogs/codeblock
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-09-09 14:07:55 -0700
committerGravatar MarkKoz <[email protected]>2020-09-09 14:07:55 -0700
commit899e5bf221dc74d62ef05ac6fbf4d8b34112e40d (patch)
treeaf72bde3cbf48f3ca06164fc0cc5f1c338b7fd35 /bot/cogs/codeblock
parentCode block: make _get_leading_spaces more readable (diff)
parentMerge pull request #1144 from Numerlor/text-link-fix (diff)
Fix conflict for webhook token check in code block detection
Diffstat (limited to '')
-rw-r--r--bot/cogs/codeblock/cog.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/bot/cogs/codeblock/cog.py b/bot/cogs/codeblock/cog.py
index c29dcaa4f..5ebc596fb 100644
--- a/bot/cogs/codeblock/cog.py
+++ b/bot/cogs/codeblock/cog.py
@@ -9,6 +9,7 @@ from discord.ext.commands import Cog
from bot import constants
from bot.bot import Bot
from bot.cogs.token_remover import TokenRemover
+from bot.cogs.webhook_remover import WEBHOOK_URL_RE
from bot.utils import has_lines
from bot.utils.channel import is_help_channel
from bot.utils.messages import wait_for_deletion
@@ -127,13 +128,14 @@ class CodeBlockCog(Cog, name="Code Block"):
1. Is not authored by a bot
2. Is in a valid channel
3. Has more than 3 lines
- 4. Has no bot token
+ 4. Has no bot or webhook token
"""
return (
not message.author.bot
and self.is_valid_channel(message.channel)
and has_lines(message.content, constants.CodeBlock.minimum_lines)
and not TokenRemover.find_token_in_message(message)
+ and not WEBHOOK_URL_RE.search(message.content)
)
@Cog.listener()