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

[Streamlabs] Unexpected "amount" format on Youtube Superchat #10

Open
iGoodie opened this issue Sep 7, 2019 · 2 comments
Open

[Streamlabs] Unexpected "amount" format on Youtube Superchat #10

iGoodie opened this issue Sep 7, 2019 · 2 comments
Assignees
Labels

Comments

@iGoodie
Copy link
Owner

iGoodie commented Sep 7, 2019

Describe the bug
Streamlabs Socket API sends Youtube Superchat event with the amount multiplied with 1_000_000 (?)

To Reproduce

  1. Replay a Youtube Superchat event on Streamlabs Dashboard
  2. Check messages array and find amount field
  3. The value seems to be multiplied with 1_000_000

image

Expected behavior
The donation value in human-readable format, just like on other events.

Version (please complete the following information):

  • OS: Windows
  • TwitchSpawn Version: v1.2.5
  • Forge Version: -

Additional context
This is an inconsistency (?) that can only be fixed by Streamlabs Socket API developers. Contact them and report this inconsistency.

@iGoodie iGoodie added the bug label Sep 7, 2019
@iGoodie iGoodie self-assigned this Sep 7, 2019
@iGoodie iGoodie pinned this issue Sep 7, 2019
@iGoodie iGoodie changed the title [Streamlabs] Unexpected "amount" format on Youtube Sponsor [Streamlabs] Unexpected "amount" format on Youtube Superchat Sep 7, 2019
@hasanmanzak
Copy link

This is actually a localization problem. Let me expand:

The amount field probably mapped to a decimal field which happens to be defaulted by various dbms as decimal(19,6) which means 19 figures before decimal point, 6 figures after. So your 2$ value is recorded as "0000000000000000002.0000000" to the DB.

We, the people in Turkiye, represent money values as "." as thousands seperator and "," as decimal seperator, but most of the world is the other way around, "." as decimal point and "," as thousands seperator. So that generates a confusion and requires serious attention by programmers. Why?

If you write code to "." being decimal point and have "2$" stored "2.000000" respectively and host in Turkiye, then what you get back is "2.000.000".

Notify them to check their "string to decimal" and "decimal to string" conversions to be based upon "Invariant Culture".

@iGoodie
Copy link
Owner Author

iGoodie commented Mar 2, 2020

Thanks for that beautifully written explanation @hasanmanzak! 🎉

Precision and localization concerns seem to be the cause of that as you mentioned.
However at this point I'm not sure if that is an inconsistency or I should just handle that in the client side. It would be pretty fun if I handled that internally, and then suddenly the way Streamlabs represent that value was changed.

Anyways currently the TSL matching a $2.00 Youtube Superchat looks like so:

...
 ON Youtube Superchat
 WITH amount = 2000000

The amount looks confusing to the user, because it is way different than the other TSL Predicates.
And I believe I will resolve this issue by parsing displayString instead in the next TwitchSpawnLanguage implementation, until I hear from Streamlabs' Support Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants