aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/help_channels/_cog.py6
-rw-r--r--bot/exts/help_channels/_message.py6
2 files changed, 9 insertions, 3 deletions
diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py
index 3c6cf7f26..0905cb23d 100644
--- a/bot/exts/help_channels/_cog.py
+++ b/bot/exts/help_channels/_cog.py
@@ -376,6 +376,12 @@ class HelpChannels(commands.Cog):
log.trace(f"Moving #{channel} ({channel.id}) to the Available category.")
+ # Unpin any previously stuck pins
+ log.trace(f"Looking for pins stuck in #{channel} ({channel.id}).")
+ for message in await channel.pins():
+ await _message.pin_wrapper(message.id, channel, pin=False)
+ log.debug(f"Removed a stuck pin from #{channel} ({channel.id}). ID: {message.id}")
+
await _channel.move_to_bottom(
channel=channel,
category_id=constants.Categories.help_available,
diff --git a/bot/exts/help_channels/_message.py b/bot/exts/help_channels/_message.py
index a52c67570..241dd606c 100644
--- a/bot/exts/help_channels/_message.py
+++ b/bot/exts/help_channels/_message.py
@@ -174,7 +174,7 @@ async def notify(channel: discord.TextChannel, last_notification: t.Optional[Arr
async def pin(message: discord.Message) -> None:
"""Pin an initial question `message` and store it in a cache."""
- if await _pin_wrapper(message.id, message.channel, pin=True):
+ if await pin_wrapper(message.id, message.channel, pin=True):
await _caches.question_messages.set(message.channel.id, message.id)
@@ -205,7 +205,7 @@ async def unpin(channel: discord.TextChannel) -> None:
if msg_id is None:
log.debug(f"#{channel} ({channel.id}) doesn't have a message pinned.")
else:
- await _pin_wrapper(msg_id, channel, pin=False)
+ await pin_wrapper(msg_id, channel, pin=False)
def _match_bot_embed(message: t.Optional[discord.Message], description: str) -> bool:
@@ -220,7 +220,7 @@ def _match_bot_embed(message: t.Optional[discord.Message], description: str) ->
return message.author == bot.instance.user and bot_msg_desc.strip() == description.strip()
-async def _pin_wrapper(msg_id: int, channel: discord.TextChannel, *, pin: bool) -> bool:
+async def pin_wrapper(msg_id: int, channel: discord.TextChannel, *, pin: bool) -> bool:
"""
Pin message `msg_id` in `channel` if `pin` is True or unpin if it's False.