Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

fix: Channel pain points #596

Merged
merged 2 commits into from
Aug 10, 2022
Merged
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
7 changes: 7 additions & 0 deletions naff/models/discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ def gui_position(self) -> int:

@classmethod
def _process_dict(cls, data: Dict[str, Any], client: "Client") -> Dict[str, Any]:
data = super()._process_dict(data, client)
if overwrites := data.get("permission_overwrites"):
data["permission_overwrites"] = PermissionOverwrite.from_list(overwrites)
return data
Expand Down Expand Up @@ -1806,6 +1807,11 @@ def mention(self) -> str:
"""Returns a string that would mention this thread."""
return f"<#{self.id}>"

@property
def permission_overwrites(self) -> List["PermissionOverwrite"]:
"""The permission overwrites for this channel."""
return []

async def fetch_members(self) -> List["models.ThreadMember"]:
"""Get the members that have access to this thread."""
members_data = await self._client.http.list_thread_members(self.id)
Expand Down Expand Up @@ -2191,6 +2197,7 @@ class GuildForum(GuildChannel):

@classmethod
def _process_dict(cls, data: Dict[str, Any], client: "Client") -> Dict[str, Any]:
data = super()._process_dict(data, client)
data["available_tags"] = [
ThreadTag.from_dict(tag_data | {"parent_channel_id": data["id"]}, client)
for tag_data in data.get("available_tags", [])
Expand Down