Support GUILD_MEDIA channel type
tibue99 opened this issue · 4 comments
Summary
Messages in GUILD_MEDIA channels can lead to errors in current bots if they are not implemented.
What is the feature request for?
The core library
The Problem
When trying to fetch a media channel, an InvalidData
error is thrown.
The Ideal Solution
Add GUILD_MEDIA
as a channel type
The Current Solution
No response
Additional Context
No response
Media channels are hard to test because of their beta/exclusivity status, but for the most part they should operate the same as ForumChannel - do you have any examples/tracebacks we can look at? Or is it just the fact we never added the GUILD_MEDIA
type (i.e. if you add media = 16
to enums.py -> ChannelType
and adjust channel.py -> _guild_channel_factory
to convert ChannelType.media
to ForumChannel
, does that fix your issues?)
It's hard to test for me, but here is my traceback. Adding the channel type might fix it.
Traceback (most recent call last):
File "/home/container/.local/lib/python3.11/site-packages/discord/client.py", line 442, in _run_event
await coro(*args, **kwargs)
File "/home/container/cogs/level_system.py", line 257, in on_message
parent_channel = await get_or_fetch(
^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/discord/utils.py", line 624, in get_or_fetch
getter = await getattr(obj, f"fetch_{attr}")(id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/discord/client.py", line 1878, in fetch_channel
raise InvalidData(
discord.errors.InvalidData: Unknown channel type 16 for channel ID 1299532652516216956.
Yeah that's the problem, I'm gonna fix it on master, please test it.
Guild media channels have some extra properties but that shouldn't pose a problem.
To reproduce this, a media channel can ID be put into utils.get_or_fetch