Skip to content

Commit

Permalink
feat: support media channels (#1458)
Browse files Browse the repository at this point in the history
* feat: support media channels

* feat: rename media channel to GuildMedia to fit convention

Co-authored-by:  i0bs <41456914+i0bs@users.noreply.github.com>

* feat: add guild media to namespace

* fix: handle enum value name change

---------

Co-authored-by: i0bs <41456914+i0bs@users.noreply.github.com>
  • Loading branch information
LordOfPolls and i0bs authored Jul 7, 2023
1 parent b4d337b commit 21f51b4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions interactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
GuildForum,
GuildForumPost,
GuildIntegration,
GuildMedia,
GuildNews,
GuildNewsConverter,
GuildNewsThread,
Expand Down Expand Up @@ -476,6 +477,7 @@
"GuildForum",
"GuildForumPost",
"GuildIntegration",
"GuildMedia",
"GuildNews",
"GuildNewsConverter",
"GuildNewsThread",
Expand Down
2 changes: 2 additions & 0 deletions interactions/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
GuildForum,
GuildForumPost,
GuildIntegration,
GuildMedia,
GuildNews,
GuildNewsThread,
GuildPreview,
Expand Down Expand Up @@ -411,6 +412,7 @@
"GuildForum",
"GuildForumPost",
"GuildIntegration",
"GuildMedia",
"GuildNews",
"GuildNewsConverter",
"GuildNewsThread",
Expand Down
2 changes: 2 additions & 0 deletions interactions/models/discord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
GuildChannel,
GuildForum,
GuildForumPost,
GuildMedia,
GuildNews,
GuildNewsThread,
GuildPrivateThread,
Expand Down Expand Up @@ -234,6 +235,7 @@
"GuildForum",
"GuildForumPost",
"GuildIntegration",
"GuildMedia",
"GuildNews",
"GuildNewsThread",
"GuildPreview",
Expand Down
7 changes: 7 additions & 0 deletions interactions/models/discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2640,6 +2640,11 @@ async def delete_tag(self, tag_id: "Snowflake_Type") -> None:
self._client.cache.place_channel_data(data)


@attrs.define(eq=False, order=False, hash=False, kw_only=True)
class GuildMedia(GuildForum):
...


def process_permission_overwrites(
overwrites: Union[dict, PermissionOverwrite, List[Union[dict, PermissionOverwrite]]]
) -> List[dict]:
Expand Down Expand Up @@ -2694,6 +2699,7 @@ def process_permission_overwrites(
GuildVoice,
GuildStageVoice,
GuildForum,
GuildMedia,
GuildPublicThread,
GuildForumPost,
GuildPrivateThread,
Expand Down Expand Up @@ -2731,4 +2737,5 @@ def process_permission_overwrites(
ChannelType.DM: DM,
ChannelType.GROUP_DM: DMGroup,
ChannelType.GUILD_FORUM: GuildForum,
ChannelType.GUILD_MEDIA: GuildMedia,
}
4 changes: 4 additions & 0 deletions interactions/models/discord/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,8 @@ class ChannelType(CursedIntEnum):
"""Voice channel for hosting events with an audience"""
GUILD_FORUM = 15
"""A Forum channel"""
GUILD_MEDIA = 16
"""Channel that can only contain threads, similar to `GUILD_FORUM` channels"""

@property
def guild(self) -> bool:
Expand Down Expand Up @@ -794,6 +796,8 @@ class ChannelFlags(DiscordIntFlag):
""" Thread is pinned to the top of its parent forum channel """
CLYDE_THREAD = 1 << 8
"""This thread was created by Clyde"""
HIDE_MEDIA_DOWNLOAD_OPTIONS = 1 << 15
"""when set hides the embedded media download options. Available only for media channels"""

# Special members
NONE = 0
Expand Down

0 comments on commit 21f51b4

Please sign in to comment.