vionya / discord-rich-presence

A cross-platform Discord Rich Presence library written in Rust
MIT License
89 stars 16 forks source link

Calling Activity::buttons on an empty Vec causes DiscordIpc::set_activity to silently fail #17

Closed silvanshade closed 1 year ago

silvanshade commented 1 year ago

I noticed that calling Activity::buttons on an empty Vec<Button> causes DiscordIpc::set_activity to silently fail. I don't know if this is expected behavior or not but I didn't see it documented anywhere so I thought I should create an issue about it.

vionya commented 1 year ago

Silently fail as in, other data in the set_activity payload is also ignored, or the buttons data is ignored? An Activity::buttons with an empty Vec should be serialized properly - and if it's failing in that scenario, it seems like it'd be a Discord problem.

silvanshade commented 1 year ago

Silently fail as in, other data in the set_activity payload is also ignored, or the buttons data is ignored? An Activity::buttons with an empty Vec should be serialized properly - and if it's failing in that scenario, it seems like it'd be a Discord problem.

By failing silently I mean the rich presence status doesn't get updated -- any part of it, not just the buttons. It's like the call to set_activity never happens.

I can believe it's a bug in the discord implementation but it might be worth noting in the docs at least, and perhaps even just handling it gracefully in this library (by not including the buttons data in the serialization if the vector is empty).

vionya commented 1 year ago

Alright, gotcha. Thanks for clarifying.

I'll see if I can confirm if it's a lib or Discord issue, and fix appropriately soon.