aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Savant-Dev <[email protected]>2020-05-01 06:17:03 -0400
committerGravatar Savant-Dev <[email protected]>2020-05-01 06:17:03 -0400
commitbc478485248199f93ee8d5a64ddcb7516f1c6ef5 (patch)
tree7cf0f4926189fe63f7cedb31e3847aa258e594d5
parentRun a category check before logging that we are checking for an answered help... (diff)
Update extension filter to distinguish .txt in cases where messages are longer than 2000 characters
-rw-r--r--bot/cogs/antimalware.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/bot/cogs/antimalware.py b/bot/cogs/antimalware.py
index 79bf486a4..053f1a01d 100644
--- a/bot/cogs/antimalware.py
+++ b/bot/cogs/antimalware.py
@@ -38,6 +38,18 @@ class AntiMalware(Cog):
"It looks like you tried to attach a Python file - "
f"please use a code-pasting service such as {URLs.site_schema}{URLs.site_paste}"
)
+ elif ".txt" in extensions_blocked:
+ # Work around Discord AutoConversion of messages longer than 2000 chars to .txt
+ cmd_channel = self.bot.get_channel(Channels.bot_commands)
+ embed.description = (
+ "**Uh-oh!** It looks like your message got zapped by our spam filter. "
+ "We currently don't allow `.txt` attachments, so here are some tips to help you travel safely: \n\n"
+ "**1.** You tried to send a message longer than 2000 characters (Discord uploads these as files) \n"
+ "• Try shortening your message to fit within the character limit or use a pasting service (see below) "
+ "\n\n**2.** You tried to show someone your code (no worries, we'd love to see it!)\n"
+ f"• Try using codeblocks (run `!code-blocks` in {cmd_channel.mention}) or use a pasting service \n\n"
+ f"If you would like, here is a pasting service we like to use: {URLs.site_schema}{URLs.site_paste}"
+ )
elif extensions_blocked:
whitelisted_types = ', '.join(AntiMalwareConfig.whitelist)
meta_channel = self.bot.get_channel(Channels.meta)