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

Thread channels don't appear to be cached #2991

Open
devoxin opened this issue Oct 17, 2024 · 2 comments
Open

Thread channels don't appear to be cached #2991

devoxin opened this issue Oct 17, 2024 · 2 comments
Assignees
Labels
discord feature Related to Discord's functionality. model Related to the `model` module. opinions wanted Discussion or solution to a problem requested.

Comments

@devoxin
Copy link

devoxin commented Oct 17, 2024

When running a starboard bot with pretty much a default configuration, the bot is unable to find thread channels in its cache causing events to be discarded.

The bot is present in the thread's member list and can receive events for the channel.
Can provide more information on request but at present, not sure what else to mention.

@GnomedDev GnomedDev self-assigned this Oct 17, 2024
@GnomedDev GnomedDev added possible bug Proclaimed misbehaviour that has not been confirmed by developers yet. cache Related to the `cache`-feature. labels Oct 17, 2024
@GnomedDev
Copy link
Member

Reproduced locally. Looking into it more.

@GnomedDev GnomedDev added discord feature Related to Discord's functionality. opinions wanted Discussion or solution to a problem requested. model Related to the `model` module. and removed possible bug Proclaimed misbehaviour that has not been confirmed by developers yet. cache Related to the `cache`-feature. labels Oct 17, 2024
@GnomedDev
Copy link
Member

Okay, looking at discord's developer documentation and serenity's implementation, it looks like we are modeling threads as GuildChannels as expected, but then storing the tread in Guild::threads as discord does.. leading to guild.channels lookups to fail.

This doesn't sound intuitive or good at all, as you can't guarantee a message being sent to a channel has it's Message::channel_id in Guild::channels, but on the other hand we are somewhat following discord's modeling which is generally a good thing.

There are two solutions to this:

  • Stop modeling threads as GuildChannels, go full out Discord

This will remove a bunch of fields from GuildChannel, so memory wins, but keep the status quo that runs into this issue.

  • Start modeling threads as full channels

This would involve moving threads to Guild::channels and possibly removing the Guild::threads field. This would require custom deserialization for Guild, which is not impossible but would be annoying.

I'll open a poll on the serenity discord and we can see where to go from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discord feature Related to Discord's functionality. model Related to the `model` module. opinions wanted Discussion or solution to a problem requested.
Projects
None yet
Development

No branches or pull requests

2 participants