filwiesner / TmiK

Twitch messaging in Kotlin - Simple DSL for interacting with Twitch chat
MIT License
8 stars 1 forks source link

NumberFormatException in rawmessages after Twitch "predictions" has been introduced #7

Closed mkpazon closed 3 years ago

mkpazon commented 3 years ago

A couple of days ago Twitch introduced Predictions . I am not entirely sure how it works, but what is clear is that it crashes the app due to a NumberFormatException. Here is an example RawMessage :

RawMessage(raw=@badge-info=predictions/Yes\si\sthink\sso,subscriber/11;badges=predictions/blue-1 ...)

It crashes in the badges bit blue-1 with a NumberFormatException

Here is the stacktrace:

java.lang.NumberFormatException: For input string: "blue-1"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:652)
    at java.lang.Integer.parseInt(Integer.java:770)
    at com.ktmi.tmi.messages.UtilityKt.parseTwitchPairSet(Utility.kt:52)
    at com.ktmi.tmi.messages.TwitchMessagesKt.get_badges(TwitchMessages.kt:41)
    at com.ktmi.tmi.messages.TwitchMessagesKt.access$get_badges$p(TwitchMessages.kt:1)
    at com.ktmi.tmi.messages.TextMessage.getBadges(TwitchMessages.kt:150)
    at com.ktmi.tmi.messages.TwitchMessagesKt.isSubscriber(TwitchMessages.kt:32)
filwiesner commented 3 years ago

Thank you for submitting the bug. I'll try too look into it sometimes this week.