AmandaDiscord / Volcano

A light-weight LavaLink compatible replacement
MIT License
71 stars 15 forks source link

Timestamps on stats and player state breaks a .NET lavalink wrapper #30

Closed heitorgcosta closed 1 year ago

heitorgcosta commented 1 year ago

Hello! Been experimenting with Volcano since I wanted a lower memory footprint but found an issue with it. Currently I'm developing a bot using Discord.NET and Lavalink4Net as a lavalink wrapper, but the timestamps that comes from both getStats(), from Util.ts (uptime field), and the state() getter from worker.ts (time field) breaks the parsing for Lavalink4Net.

The one from getStats() sometimes is sent with decimal places, but the parser expects a value that can be converted into a DateTimeOffset (e.g. an int). The one from state() is sent as a string, but the parser also expects a value to be converted to DateTimeOffset.

Doing either a Math.trunc or Math.floor on both seems to fix the issue, but I'm not sure if that would cause issues with other wrappers out there.

PapiOphidian commented 1 year ago

The LavaLink docs used to say it was a string when I was writing LavaLinkTypes iirc, but it seems like this was updated. I'll fix when I get a chance

PapiOphidian commented 1 year ago

Which JSON prop from getStats is expected to be an int? uptime?

heitorgcosta commented 1 year ago

Yes, it is uptime

PapiOphidian commented 1 year ago

Completed in 1.5.7