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

Fix some gateway deserialization errors #577

Merged
merged 11 commits into from
Nov 21, 2024

Conversation

kozabrada123
Copy link
Member

@kozabrada123 kozabrada123 commented Nov 3, 2024

See the commits;

  • Discord is messing with their api again, read states are a mystery
  • Refactored the gateway to fully use the Opcode enum instead of constants (4ed68ce)
  • Added Last Messages request and response (4ed68ce)
  • Fixed a deserialization error related to presences in GuildMembersChunk being an array, not a single value (4baecf9)
  • Fixed a deserialization error with deserializing activities in PresenceUpdate as an empty array when they are sent as null (1b20102)
  • Add type OneOrMoreSnowflakes, allow GatewayRequestGuildMembers to request multiple guild and user ids (644d3be, 85e922b)
  • Updated LazyRequest (op 14) to use the Snowflake type for ids instead of just String (61ac7d1)
  • Fixed a deserialization error on discord.com related to experiments (they are not implemented yet, see Implement Experiments #578) (7feb571)
  • Fixed a deserialization error on discord.com related to last_viewed in ReadState being a version / counter, not a DateTime (fb94afa)

Spacebar servers have mention_count in ReadStateEntry as nullable, as well as not having the flags field

This should probably be investigated further

Reported by greysilly7 on the polyphony discord
@kozabrada123 kozabrada123 marked this pull request as ready for review November 3, 2024 18:32
Adds a public type which allows serializing one snowflake or an array of snowflakes.

Useful for e.g. request guild members, where we can request either for one user or for multiple
Updates the RequsetGuildMembers gateway event, allows to query multiple user_ids and guild_ids using OneOrMoreSnowflakes type, update its documentation
See also #578 on why we aren't currently juts implementing them as types
thanks to MaddyUnderStars; this explanation seems to make sense considering we only need to know if we are ahead / behind the version, not when exactly it was accessed
@kozabrada123
Copy link
Member Author

It's worth noting that the tests pass locally for me, and it seems our CI is broken again
I don't think anything in this pr, specifically anything in the commit which just adds 2 Default implementations, causes a crash on WASM

@kozabrada123 kozabrada123 merged commit 7369016 into dev Nov 21, 2024
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant