Skip to content

Commit 21f51b4

Browse files
LordOfPollsi0bs
andauthored
feat: support media channels (#1458)
* 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>
1 parent b4d337b commit 21f51b4

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

interactions/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
GuildForum,
150150
GuildForumPost,
151151
GuildIntegration,
152+
GuildMedia,
152153
GuildNews,
153154
GuildNewsConverter,
154155
GuildNewsThread,
@@ -476,6 +477,7 @@
476477
"GuildForum",
477478
"GuildForumPost",
478479
"GuildIntegration",
480+
"GuildMedia",
479481
"GuildNews",
480482
"GuildNewsConverter",
481483
"GuildNewsThread",

interactions/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
GuildForum,
6868
GuildForumPost,
6969
GuildIntegration,
70+
GuildMedia,
7071
GuildNews,
7172
GuildNewsThread,
7273
GuildPreview,
@@ -411,6 +412,7 @@
411412
"GuildForum",
412413
"GuildForumPost",
413414
"GuildIntegration",
415+
"GuildMedia",
414416
"GuildNews",
415417
"GuildNewsConverter",
416418
"GuildNewsThread",

interactions/models/discord/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
GuildChannel,
1414
GuildForum,
1515
GuildForumPost,
16+
GuildMedia,
1617
GuildNews,
1718
GuildNewsThread,
1819
GuildPrivateThread,
@@ -234,6 +235,7 @@
234235
"GuildForum",
235236
"GuildForumPost",
236237
"GuildIntegration",
238+
"GuildMedia",
237239
"GuildNews",
238240
"GuildNewsThread",
239241
"GuildPreview",

interactions/models/discord/channel.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,6 +2640,11 @@ async def delete_tag(self, tag_id: "Snowflake_Type") -> None:
26402640
self._client.cache.place_channel_data(data)
26412641

26422642

2643+
@attrs.define(eq=False, order=False, hash=False, kw_only=True)
2644+
class GuildMedia(GuildForum):
2645+
...
2646+
2647+
26432648
def process_permission_overwrites(
26442649
overwrites: Union[dict, PermissionOverwrite, List[Union[dict, PermissionOverwrite]]]
26452650
) -> List[dict]:
@@ -2694,6 +2699,7 @@ def process_permission_overwrites(
26942699
GuildVoice,
26952700
GuildStageVoice,
26962701
GuildForum,
2702+
GuildMedia,
26972703
GuildPublicThread,
26982704
GuildForumPost,
26992705
GuildPrivateThread,
@@ -2731,4 +2737,5 @@ def process_permission_overwrites(
27312737
ChannelType.DM: DM,
27322738
ChannelType.GROUP_DM: DMGroup,
27332739
ChannelType.GUILD_FORUM: GuildForum,
2740+
ChannelType.GUILD_MEDIA: GuildMedia,
27342741
}

interactions/models/discord/enums.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ class ChannelType(CursedIntEnum):
611611
"""Voice channel for hosting events with an audience"""
612612
GUILD_FORUM = 15
613613
"""A Forum channel"""
614+
GUILD_MEDIA = 16
615+
"""Channel that can only contain threads, similar to `GUILD_FORUM` channels"""
614616

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

798802
# Special members
799803
NONE = 0

0 commit comments

Comments
 (0)