Skip to content

Commit 73fcd1f

Browse files
committed
add onhypechat formatted amount
1 parent 3576e7c commit 73fcd1f

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

js/Documentation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,8 @@ _WARNING: Kruiz Control responds to messages sent by Kruiz Control. Please be mi
742742
**user** | The display name of the user that sent the command.
743743
**message** | The entire chat message, including the command.
744744
**message_id** | The id of the message (used with [Twitch DeleteMessage](#twitch-deletemessage)). If the message was sent by Kruiz Control, the id will be an empty string (`""`).
745-
**amount** | The value of the Hype Chat sent by the user.
745+
**amount** | The value of the Hype Chat sent by the user. Example: `500` if $5 was tipped.
746+
**formatted_amount** | The formatted value of the Hype Chat sent by the user. Example: `5.00` is $5 was tipped.
746747
**currency** | The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes) alphabetic currency code the user has sent the Hype Chat in.
747748
**exponent** | Indicates how many decimal points this currency represents partial amounts in. Decimal points start from the right side of the value defined in `amount`.
748749
**level** | The level of the Hype Chat, in English. Possible values are [`ONE`, `TWO`, ..., `TEN`], written in all caps.

js/chat/chatHandler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ class ChatHandler extends Handler {
468468
var userState = data.data.extra.userState;
469469
var hypeChatData = {
470470
amount: userState["pinned-chat-paid-amount"],
471+
formatted_amount: (userState["pinned-chat-paid-amount"] / Math.pow(10, userState["pinned-chat-paid-exponent"])).toFixed(userState["pinned-chat-paid-exponent"]),
471472
currency: userState["pinned-chat-paid-currency"],
472473
exponent: userState["pinned-chat-paid-exponent"],
473474
level: userState["pinned-chat-paid-level"],

0 commit comments

Comments
 (0)