aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-03-19 16:35:56 +0000
committerGravatar Chris Lovering <[email protected]>2022-04-18 17:44:30 +0100
commit4635c31b1860c34a898977a148fdf0a6a84b2614 (patch)
tree2f92b2afe5314a16501c04d5d3ee175de3c95eb5
parentUse bot-core scheduling and member util functions (diff)
Don't use discord.NoMoreItems as it's removed
This has been removed in favour of Python's built-in StopAsyncIteration error
-rw-r--r--bot/exts/help_channels/_message.py2
-rw-r--r--bot/exts/recruitment/talentpool/_review.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/bot/exts/help_channels/_message.py b/bot/exts/help_channels/_message.py
index 7ceed9b4d..f4c3a6fd7 100644
--- a/bot/exts/help_channels/_message.py
+++ b/bot/exts/help_channels/_message.py
@@ -68,7 +68,7 @@ async def get_last_message(channel: discord.TextChannel) -> t.Optional[discord.M
try:
return await channel.history(limit=1).next() # noqa: B305
- except discord.NoMoreItems:
+ except StopAsyncIteration:
log.debug(f"No last message available; #{channel} ({channel.id}) has no messages.")
return None
diff --git a/bot/exts/recruitment/talentpool/_review.py b/bot/exts/recruitment/talentpool/_review.py
index 214d85851..d0edf5388 100644
--- a/bot/exts/recruitment/talentpool/_review.py
+++ b/bot/exts/recruitment/talentpool/_review.py
@@ -11,7 +11,7 @@ from typing import List, Optional, Union
import arrow
from botcore.utils.scheduling import Scheduler
from dateutil.parser import isoparse
-from discord import Embed, Emoji, Member, Message, NoMoreItems, NotFound, PartialMessage, TextChannel
+from discord import Embed, Emoji, Member, Message, NotFound, PartialMessage, TextChannel
from discord.ext.commands import Context
from bot.api import ResponseCodeError
@@ -151,7 +151,7 @@ class Reviewer:
# We consider the first message in the nomination to contain the user ping, username#discrim, and fixed text
messages = [message]
if not NOMINATION_MESSAGE_REGEX.search(message.content):
- with contextlib.suppress(NoMoreItems):
+ with contextlib.suppress(StopAsyncIteration):
async for new_message in message.channel.history(before=message.created_at):
messages.append(new_message)