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

Support GUILD_MEDIA channel type #2637

Open
tibue99 opened this issue Nov 5, 2024 · 4 comments · May be fixed by #2641
Open

Support GUILD_MEDIA channel type #2637

tibue99 opened this issue Nov 5, 2024 · 4 comments · May be fixed by #2641
Labels
bug Something isn't working
Milestone

Comments

@tibue99
Copy link
Contributor

tibue99 commented Nov 5, 2024

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

@tibue99 tibue99 added the feature request New feature request label Nov 5, 2024
@NeloBlivion
Copy link
Member

NeloBlivion commented Nov 8, 2024

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?)

@tibue99
Copy link
Contributor Author

tibue99 commented Nov 8, 2024

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.

@Lulalaby
Copy link
Member

Lulalaby commented Nov 8, 2024

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.

@tibue99
Copy link
Contributor Author

tibue99 commented Nov 8, 2024

To reproduce this, a media channel can ID be put into utils.get_or_fetch

@Lulalaby Lulalaby added bug Something isn't working and removed feature request New feature request labels Nov 8, 2024
@Lulalaby Lulalaby added this to the v2.7 milestone Nov 8, 2024
@Paillat-dev Paillat-dev linked a pull request Nov 8, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants