Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support media channels #1050

Merged
merged 34 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
dbf8d6f
feat: basic media channel implementation
onerandomusername Jun 15, 2023
6a98dab
add more support
onerandomusername Jun 15, 2023
53b79b9
add simple changelog
onerandomusername Jun 15, 2023
fe507be
refactor forum channels into a base class
onerandomusername Jun 15, 2023
05cf41b
refactor channel webhooks to a mixin
onerandomusername Jun 15, 2023
41a1f28
chore: rename class to ThreadOnlyGuildChannel
onerandomusername Jun 15, 2023
03605cd
fix: channel factory
onerandomusername Jun 15, 2023
50bc574
fix: document MediaChannel
onerandomusername Jun 18, 2023
116a096
fix: use ` not '
onerandomusername Jun 18, 2023
aa13cd1
fix: update docstring for hide_media_download_options
onerandomusername Jun 18, 2023
82277e6
chore: add ChannelType.media to docs
onerandomusername Jun 18, 2023
69a5705
fix slots (probably)
onerandomusername Jun 18, 2023
72c4209
Merge remote-tracking branch 'origin/master' into feat/media-channel
onerandomusername Jul 26, 2023
3e5ed18
revert: "refactor channel webhooks to a mixin"
shiftinv Aug 1, 2023
8f64746
chore: run codemod
shiftinv Aug 1, 2023
91f381a
chore(docs): update versionadded
shiftinv Aug 1, 2023
5ad01f3
Merge branch 'master' into feat/media-channel
onerandomusername Aug 11, 2023
8751aef
Merge remote-tracking branch 'upstream/master'
shiftinv Feb 12, 2024
b2ca01e
refactor: drop `create_thread` impls in derived classes
shiftinv Feb 12, 2024
7b08757
chore: move comment to correct location
shiftinv Feb 12, 2024
d779a93
fix: move `default_layout` to `ForumChannel`, fix return annotations`
shiftinv Feb 12, 2024
ddf89b4
fix: add missing _fill_overwrites call
shiftinv Feb 12, 2024
b35840d
chore: implement `_get_channel` in base type
shiftinv Feb 12, 2024
b9b8a17
refactor: implement `typing` in base type
shiftinv Feb 12, 2024
f560631
nit: is forumable even a word
shiftinv Feb 12, 2024
972f4cd
fix: handle media channels in `Message.system_content`
shiftinv Feb 12, 2024
aeaef9a
chore: rename `disnake.types.channel._BaseForumGuildChannel`
shiftinv Feb 12, 2024
413c051
fix: consider media channels in audit log tag_id fallback
shiftinv Feb 12, 2024
dcfbbaa
docs: clarify that media channels are essentially fancy forum channels
shiftinv Feb 12, 2024
9e7fc7c
fix: add missing attributes for accessing/creating media channels
shiftinv Feb 12, 2024
60ae8bd
docs: add missing media channel docs, update docs that previously onl…
shiftinv Feb 12, 2024
7546350
feat: add `MediaChannel.hides_media_download_options` shortcut
shiftinv Feb 12, 2024
f0a56a9
docs: more documentation nits
shiftinv Feb 12, 2024
1abcafd
Merge branch 'master' into feat/media-channel
shiftinv Feb 12, 2024
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 changelog/1050.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- Add support for Media channels.
- Add :class:`MediaChannel`.
- Unless otherwise noted, MediaChannels behave just like ForumChannels
- Add :attr:`CategoryChannel.media_channels`, :attr:`Guild.media_channels`
- Add :attr:`CategoryChannel.create_media_channel`, :attr:`Guild.create_media_channel`
- Add :attr:`ChannelFlags.hide_media_download_options`.
- Add support for :class:`MediaChannel` threads to :func:`Thread.add_tags` and :func:`Thread.remove_tags`.
1 change: 1 addition & 0 deletions disnake/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class GuildChannel(ABC):
- :class:`.CategoryChannel`
- :class:`.StageChannel`
- :class:`.ForumChannel`
- :class:`.MediaChannel`

This ABC must also implement :class:`.abc.Snowflake`.

Expand Down
4 changes: 2 additions & 2 deletions disnake/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ def _transform_tag_id(
return None

# cyclic imports
from .channel import ForumChannel
from .channel import ForumChannel, MediaChannel

tag: Optional[ForumTag] = None
tag_id = int(data)
thread = entry.target
# try thread parent first
if isinstance(thread, Thread) and isinstance(thread.parent, ForumChannel):
if isinstance(thread, Thread) and isinstance(thread.parent, (ForumChannel, MediaChannel)):
tag = thread.parent.get_tag(tag_id)
else:
# if not found (possibly deleted thread), search all forum channels
Expand Down
Loading