Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bot/exts/info/information.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,10 @@ async def rules(self, ctx: Context, *, args: str | None) -> set[int] | None:

if constants.Roles.helpers not in {role.id for role in ctx.author.roles}:
# If the user is not a helper, send an alert to the rules thread.
await self._send_rules_alert(ctx, sorted_rules)
#
# Exclude the bot commands channel to avoid spamming it with alerts.
if ctx.channel.id != constants.Channels.bot_commands:
await self._send_rules_alert(ctx, sorted_rules)

await LinePaginator.paginate(final_rules, ctx, rules_embed, max_lines=3)

Expand Down
10 changes: 5 additions & 5 deletions bot/exts/moderation/infraction/_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from discord.ext.commands import Context
from pydis_core.site_api import ResponseCodeError
from pydis_core.utils import scheduling
from pydis_core.utils.channel import get_or_fetch_channel

from bot import constants
from bot.bot import Bot
Expand Down Expand Up @@ -115,9 +114,9 @@ async def _delete_infraction_message(
This is used to delete infraction messages after a certain period of time.
"""
try:
channel = await get_or_fetch_channel(self.bot, channel_id)
message = await channel.fetch_message(message_id)
await message.delete()
partial_channel = self.bot.get_partial_messageable(channel_id)
partial_message = partial_channel.get_partial_message(message_id)
await partial_message.delete()
log.trace(f"Deleted infraction message {message_id} in channel {channel_id}.")
except discord.NotFound:
log.warning(f"Channel or message {message_id} not found in channel {channel_id}.")
Expand Down Expand Up @@ -322,7 +321,8 @@ async def apply_infraction(
mentions = discord.AllowedMentions(users=[user], roles=False)
sent_msg = await ctx.send(f"{dm_result}{confirm_msg}{infr_message}.", allowed_mentions=mentions)

if infraction["actor"] == self.bot.user.id:
# Only tidy up bot issued infractions in non-mod channels.
if infraction["actor"] == self.bot.user.id and not is_mod_channel(ctx.channel):
expire_message_time = datetime.now(UTC) + timedelta(hours=AUTOMATED_TIDY_UP_HOURS)

log.trace(f"Scheduling message tidy for infraction #{id_} in {AUTOMATED_TIDY_UP_HOURS} hours.")
Expand Down