diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/exts/help_channels/_message.py | 3 | ||||
| -rw-r--r-- | bot/exts/moderation/incidents.py | 2 | 
2 files changed, 3 insertions, 2 deletions
| diff --git a/bot/exts/help_channels/_message.py b/bot/exts/help_channels/_message.py index f4c3a6fd7..40bec74a5 100644 --- a/bot/exts/help_channels/_message.py +++ b/bot/exts/help_channels/_message.py @@ -67,7 +67,8 @@ async def get_last_message(channel: discord.TextChannel) -> t.Optional[discord.M      log.trace(f"Getting the last message in #{channel} ({channel.id}).")      try: -        return await channel.history(limit=1).next()  # noqa: B305 +        async for message in channel.history(limit=1): +            return message      except StopAsyncIteration:          log.debug(f"No last message available; #{channel} ({channel.id}) has no messages.")          return None diff --git a/bot/exts/moderation/incidents.py b/bot/exts/moderation/incidents.py index c0bd09b72..b65f9262f 100644 --- a/bot/exts/moderation/incidents.py +++ b/bot/exts/moderation/incidents.py @@ -183,7 +183,7 @@ async def make_message_link_embed(ctx: Context, message_link: str) -> Optional[d      except MessageNotFound:          mod_logs_channel = ctx.bot.get_channel(Channels.mod_log) -        last_100_logs: list[discord.Message] = await mod_logs_channel.history(limit=100).flatten() +        last_100_logs: list[discord.Message] = [message async for message in mod_logs_channel.history(limit=100)]          for log_entry in last_100_logs:              if not log_entry.embeds: | 
