simmsb / calamity

A library for writing discord bots in haskell
https://hackage.haskell.org/package/calamity
MIT License
109 stars 11 forks source link

Member fields #29

Closed Kaptch closed 3 years ago

Kaptch commented 3 years ago

It's rather a question than an issue. How does the Member datatype initialize a guild id field? Is it initialized somewhere inside the library? I'm trying to work on some voice chat solution, and VoiceStateUpdateData fails to be parsed from a JSON because its inner Member field fails to be parsed. I can use guild id from VoiceStateUpdateData itself, but I'm not sure if it is a good idea.

simmsb commented 3 years ago

The guild id is injected in the fromjson impl for Guild: https://github.com/nitros12/calamity/blob/master/src/Calamity/Types/Model/Guild/Guild.hs#L77

Kaptch commented 3 years ago

Oh, I see. Thank you! I'll use the same approach.