diff options
author | 2020-05-05 23:50:50 +0200 | |
---|---|---|
committer | 2020-05-05 23:50:50 +0200 | |
commit | e1e26e171022d47645abf54cbe54b14dee680e74 (patch) | |
tree | 8c648f958f20ea25173cfa2acf8e786b606caec9 | |
parent | Log unhandled errors from event listeners (diff) | |
parent | Merge pull request #925 from Savant-Dev/antimalware (diff) |
Merge branch 'master' into bug/backend/911/log-listener-exceptions
-rw-r--r-- | bot/cogs/antimalware.py | 12 | ||||
-rw-r--r-- | bot/cogs/help_channels.py | 3 | ||||
-rw-r--r-- | bot/cogs/information.py | 2 | ||||
-rw-r--r-- | tests/bot/cogs/test_information.py | 2 |
4 files changed, 16 insertions, 3 deletions
diff --git a/bot/cogs/antimalware.py b/bot/cogs/antimalware.py index 79bf486a4..66b5073e8 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" + "• If you attempted to send a message longer than 2000 characters, try shortening your message " + "to fit within the character limit or use a pasting service (see below) \n\n" + "• If you tried to show someone your code, you can use codeblocks \n(run `!code-blocks` in " + f"{cmd_channel.mention} for more information) or use a pasting service like: " + f"\n\n{URLs.site_schema}{URLs.site_paste}" + ) elif extensions_blocked: whitelisted_types = ', '.join(AntiMalwareConfig.whitelist) meta_channel = self.bot.get_channel(Channels.meta) diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py index b5cb37015..b714a1642 100644 --- a/bot/cogs/help_channels.py +++ b/bot/cogs/help_channels.py @@ -649,10 +649,11 @@ class HelpChannels(Scheduler, commands.Cog): async def check_for_answer(self, message: discord.Message) -> None: """Checks for whether new content in a help channel comes from non-claimants.""" channel = message.channel - log.trace(f"Checking if #{channel} ({channel.id}) has been answered.") # Confirm the channel is an in use help channel if self.is_in_category(channel, constants.Categories.help_in_use): + log.trace(f"Checking if #{channel} ({channel.id}) has been answered.") + # Check if there is an entry in unanswered (does not persist across restarts) if channel.id in self.unanswered: claimant_id = self.help_channel_claimants[channel].id diff --git a/bot/cogs/information.py b/bot/cogs/information.py index 4eb36c340..ef2f308ca 100644 --- a/bot/cogs/information.py +++ b/bot/cogs/information.py @@ -206,7 +206,7 @@ class Information(Cog): description="\n\n".join(description) ) - embed.set_thumbnail(url=user.avatar_url_as(format="png")) + embed.set_thumbnail(url=user.avatar_url_as(static_format="png")) embed.colour = user.top_role.colour if roles else Colour.blurple() return embed diff --git a/tests/bot/cogs/test_information.py b/tests/bot/cogs/test_information.py index 6dace1080..b5f928dd6 100644 --- a/tests/bot/cogs/test_information.py +++ b/tests/bot/cogs/test_information.py @@ -485,7 +485,7 @@ class UserEmbedTests(unittest.TestCase): user.avatar_url_as.return_value = "avatar url" embed = asyncio.run(self.cog.create_user_embed(ctx, user)) - user.avatar_url_as.assert_called_once_with(format="png") + user.avatar_url_as.assert_called_once_with(static_format="png") self.assertEqual(embed.thumbnail.url, "avatar url") |