yourWaifu / sleepy-discord

C++ library for the Discord chat client. Please use Rust for new bots
https://yourWaifu.github.io/sleepy-discord/
MIT License
707 stars 92 forks source link

Bad parsing for editMember mute/deaf #185

Closed Warpten closed 3 years ago

Warpten commented 3 years ago
        const std::string muteString = mute == -1 ? json::boolean(mute) : "";
        const std::string deafString = deaf == -1 ? json::boolean(deaf) : "";

This can't work, since if the value given for mute or deaf is anything other than -1 (so basically, true / false, which is what most users would expect), these lines will always assign "".

Invert the condition.

On top of that, how am I supposed to pass properties as nullable (for example, not editing username ?)

yourWaifu commented 3 years ago

this isn't parsing, this is serialization. other then that, username can be empty which should set that value to undefined in the serialized json.

yourWaifu commented 3 years ago

I've fixed this in https://github.com/yourWaifu/sleepy-discord/commit/70e1ef43831fd7d38d99a2121dfff1654941ff77

Warpten commented 3 years ago

thanks!