Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from MaskDuck/master
Browse files Browse the repository at this point in the history
feat: pin closing message when open thread
  • Loading branch information
VaibhavSys authored May 29, 2024
2 parents f9d62f2 + f71e2ac commit 8019aab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/exts/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import config
import asyncio


class LinkView(nextcord.ui.View):
def __init__(self, label: str, link: str):
super().__init__()
Expand Down Expand Up @@ -136,6 +137,8 @@ async def create_help_thread(self, member: nextcord.Member) -> nextcord.Thread:
thread = await forum.create_thread(
name=thread_name, embed=embed, view=close_view
)
thread_open_message: nextcord.Message = await thread.fetch_message(thread.id)
await thread_open_message.pin()
await self.bot.db.create_thread(thread.id, member.guild.id, forum.id, member.id)
return thread

Expand Down Expand Up @@ -168,7 +171,9 @@ async def close_help_thread(self, thread_id: int) -> None:
await thread_author.send(thread_close_dm, view=thread_jump_view)
except Exception:
pass
await asyncio.sleep(3) # To prevent message being sent after thread being closed on rare occasions
await asyncio.sleep(
3
) # To prevent message being sent after thread being closed on rare occasions
if config.THREAD_CLOSE_LOCK:
await thread.edit(locked=True)
await thread.edit(archived=True)
Expand Down

0 comments on commit 8019aab

Please sign in to comment.