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

Commit

Permalink
fix: Channel pain points (#596)
Browse files Browse the repository at this point in the history
* fix: ensure channel objects call their parent dict processors

* feat: add dummy permission_overwrite prop to threads
  • Loading branch information
LordOfPolls committed Aug 10, 2022
1 parent 62d6fe0 commit 4b3f977
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit 4b3f977

Please sign in to comment.