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
6 changes: 6 additions & 0 deletions bot/exts/help_channels/_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,12 @@ async def move_to_available(self) -> None:

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,
Expand Down
6 changes: 3 additions & 3 deletions bot/exts/help_channels/_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -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:
Expand All @@ -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.

Expand Down