diff options
-rw-r--r-- | bot/exts/backend/branding/_cog.py | 2 | ||||
-rw-r--r-- | bot/exts/fun/off_topic_names.py | 2 | ||||
-rw-r--r-- | bot/exts/moderation/incidents.py | 2 | ||||
-rw-r--r-- | bot/exts/utils/snekbox/_cog.py | 3 | ||||
-rw-r--r-- | bot/utils/messages.py | 3 | ||||
-rw-r--r-- | tests/bot/exts/moderation/test_incidents.py | 4 |
6 files changed, 7 insertions, 9 deletions
diff --git a/bot/exts/backend/branding/_cog.py b/bot/exts/backend/branding/_cog.py index 6472a477c..433f152b4 100644 --- a/bot/exts/backend/branding/_cog.py +++ b/bot/exts/backend/branding/_cog.py @@ -162,7 +162,7 @@ class Branding(commands.Cog): except discord.HTTPException: log.exception("Asset upload to Discord failed.") return False - except asyncio.TimeoutError: + except TimeoutError: log.error(f"Asset upload to Discord timed out after {timeout} seconds.") return False else: diff --git a/bot/exts/fun/off_topic_names.py b/bot/exts/fun/off_topic_names.py index a2941932b..21dfaee20 100644 --- a/bot/exts/fun/off_topic_names.py +++ b/bot/exts/fun/off_topic_names.py @@ -207,7 +207,7 @@ class OffTopicNames(Cog): try: await asyncio.wait_for(rename_channel(), 3) - except asyncio.TimeoutError: + except TimeoutError: # Channel rename endpoint rate limited. The task was cancelled by asyncio. btn_yes = Button(label="Yes", style=ButtonStyle.success) btn_no = Button(label="No", style=ButtonStyle.danger) diff --git a/bot/exts/moderation/incidents.py b/bot/exts/moderation/incidents.py index 2aecf787a..9c11ad96c 100644 --- a/bot/exts/moderation/incidents.py +++ b/bot/exts/moderation/incidents.py @@ -478,7 +478,7 @@ class Incidents(Cog): log.trace(f"Awaiting deletion confirmation: {timeout=} seconds") try: await confirmation_task - except asyncio.TimeoutError: + except TimeoutError: log.info(f"Did not receive incident deletion confirmation within {timeout} seconds!") else: log.trace("Deletion was confirmed") diff --git a/bot/exts/utils/snekbox/_cog.py b/bot/exts/utils/snekbox/_cog.py index 08d867d0f..db4181d68 100644 --- a/bot/exts/utils/snekbox/_cog.py +++ b/bot/exts/utils/snekbox/_cog.py @@ -1,6 +1,5 @@ from __future__ import annotations -import asyncio import contextlib import re from functools import partial @@ -460,7 +459,7 @@ class Snekbox(Cog): if code is None: return None - except asyncio.TimeoutError: + except TimeoutError: with contextlib.suppress(HTTPException): await ctx.message.clear_reaction(REDO_EMOJI) return None diff --git a/bot/utils/messages.py b/bot/utils/messages.py index 4febf09dc..57bb2c8e3 100644 --- a/bot/utils/messages.py +++ b/bot/utils/messages.py @@ -1,4 +1,3 @@ -import asyncio import random import re from collections.abc import Callable, Iterable, Sequence @@ -102,7 +101,7 @@ async def wait_for_deletion( try: try: await bot.instance.wait_for("reaction_add", check=check, timeout=timeout) - except asyncio.TimeoutError: + except TimeoutError: await message.clear_reactions() else: await message.delete() diff --git a/tests/bot/exts/moderation/test_incidents.py b/tests/bot/exts/moderation/test_incidents.py index d8e3ddd8c..444bb1142 100644 --- a/tests/bot/exts/moderation/test_incidents.py +++ b/tests/bot/exts/moderation/test_incidents.py @@ -557,7 +557,7 @@ class TestProcessEvent(TestIncidents): exception should it propagate out of `process_event`. This is so that we can then manually fail the test with a more informative message than just the plain traceback. """ - mock_task = AsyncMock(side_effect=asyncio.TimeoutError()) + mock_task = AsyncMock(side_effect=TimeoutError()) try: with patch("bot.exts.moderation.incidents.Incidents.make_confirmation_task", mock_task): @@ -566,7 +566,7 @@ class TestProcessEvent(TestIncidents): incident=MockMessage(id=123, created_at=CURRENT_TIME), member=MockMember(roles=[MockRole(id=1)]) ) - except asyncio.TimeoutError: + except TimeoutError: self.fail("TimeoutError was not handled gracefully, and propagated out of `process_event`!") |