aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Xithrius <[email protected]>2022-05-27 15:35:22 -0700
committerGravatar GitHub <[email protected]>2022-05-27 15:35:22 -0700
commit5f30adc70787f13a440ed7e53524b35dee791b79 (patch)
treefde3dbbe0b2ec7fffd171cc90b3cfbf017df7975
parentMerge branch 'main' into revert-markdownify-bump (diff)
parentCatch correct exception in clean cog (#2176) (diff)
Merge branch 'main' into revert-markdownify-bump
-rw-r--r--bot/exts/backend/error_handler.py2
-rw-r--r--bot/exts/info/tags.py6
-rw-r--r--bot/exts/moderation/clean.py2
-rw-r--r--bot/exts/utils/thread_bumper.py4
-rw-r--r--tests/bot/exts/backend/test_error_handler.py6
5 files changed, 11 insertions, 9 deletions
diff --git a/bot/exts/backend/error_handler.py b/bot/exts/backend/error_handler.py
index 5391a7f15..35dddd8dc 100644
--- a/bot/exts/backend/error_handler.py
+++ b/bot/exts/backend/error_handler.py
@@ -285,7 +285,7 @@ class ErrorHandler(Cog):
ctx.bot.stats.incr("errors.api_error_404")
elif e.status == 400:
content = await e.response.json()
- log.debug(f"API responded with 400 for command {ctx.command}: %r.", content)
+ log.error(f"API responded with 400 for command {ctx.command}: %r.", content)
await ctx.send("According to the API, your request is malformed.")
ctx.bot.stats.incr("errors.api_error_400")
elif 500 <= e.status < 600:
diff --git a/bot/exts/info/tags.py b/bot/exts/info/tags.py
index e89ffafb1..5d7467caf 100644
--- a/bot/exts/info/tags.py
+++ b/bot/exts/info/tags.py
@@ -278,7 +278,11 @@ class Tags(Cog):
if tag is None and tag_identifier.group is not None:
# Try exact match with only the name
- tag = self.tags.get(TagIdentifier(None, tag_identifier.group))
+ name_only_identifier = TagIdentifier(None, tag_identifier.group)
+ tag = self.tags.get(name_only_identifier)
+ if tag:
+ # Ensure the correct tag information is sent to statsd
+ tag_identifier = name_only_identifier
if tag is None and len(filtered_tags) == 1:
tag_identifier = filtered_tags[0][0]
diff --git a/bot/exts/moderation/clean.py b/bot/exts/moderation/clean.py
index 0f14f515e..fedb787f9 100644
--- a/bot/exts/moderation/clean.py
+++ b/bot/exts/moderation/clean.py
@@ -443,7 +443,7 @@ class Clean(Cog):
if log_url and is_mod_channel(ctx.channel):
try:
await ctx.reply(success_message)
- except errors.NotFound:
+ except errors.HTTPException:
await ctx.send(success_message)
elif log_url:
if mods := self.bot.get_channel(Channels.mods):
diff --git a/bot/exts/utils/thread_bumper.py b/bot/exts/utils/thread_bumper.py
index 7ffb79d5e..a2f208484 100644
--- a/bot/exts/utils/thread_bumper.py
+++ b/bot/exts/utils/thread_bumper.py
@@ -1,7 +1,6 @@
import typing as t
import discord
-from async_rediscache import RedisCache
from botcore.site_api import ResponseCodeError
from discord.ext import commands
@@ -18,9 +17,6 @@ THREAD_BUMP_ENDPOINT = "bot/bumped-threads"
class ThreadBumper(commands.Cog):
"""Cog that allow users to add the current thread to a list that get reopened on archive."""
- # RedisCache[discord.Thread.id, "sentinel"]
- threads_to_bump = RedisCache()
-
def __init__(self, bot: Bot):
self.bot = bot
diff --git a/tests/bot/exts/backend/test_error_handler.py b/tests/bot/exts/backend/test_error_handler.py
index 193f1d822..d02bd7c34 100644
--- a/tests/bot/exts/backend/test_error_handler.py
+++ b/tests/bot/exts/backend/test_error_handler.py
@@ -477,11 +477,11 @@ class IndividualErrorHandlerTests(unittest.IsolatedAsyncioTestCase):
@patch("bot.exts.backend.error_handler.log")
async def test_handle_api_error(self, log_mock):
- """Should `ctx.send` on HTTP error codes, `log.debug|warning` depends on code."""
+ """Should `ctx.send` on HTTP error codes, and log at correct level."""
test_cases = (
{
"error": ResponseCodeError(AsyncMock(status=400)),
- "log_level": "debug"
+ "log_level": "error"
},
{
"error": ResponseCodeError(AsyncMock(status=404)),
@@ -505,6 +505,8 @@ class IndividualErrorHandlerTests(unittest.IsolatedAsyncioTestCase):
self.ctx.send.assert_awaited_once()
if case["log_level"] == "warning":
log_mock.warning.assert_called_once()
+ elif case["log_level"] == "error":
+ log_mock.error.assert_called_once()
else:
log_mock.debug.assert_called_once()