[core] Fix: Emote sets are not int but uuid

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-09-29 19:05:12 +02:00
parent 2b1502e64f
commit 688c665356
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -1,13 +1,11 @@
package main package main
import ( import (
"strconv"
"strings" "strings"
"sync" "sync"
"github.com/Luzifer/twitch-bot/twitch" "github.com/Luzifer/twitch-bot/twitch"
"github.com/go-irc/irc" "github.com/go-irc/irc"
"github.com/pkg/errors"
) )
type ( type (
@ -15,7 +13,7 @@ type (
Badges twitch.BadgeCollection Badges twitch.BadgeCollection
Color string Color string
DisplayName string DisplayName string
EmoteSets []int64 EmoteSets []string
} }
twitchUserStateStore struct { twitchUserStateStore struct {
@ -34,18 +32,12 @@ func parseTwitchUserState(m *irc.Message) (*twitchUserState, error) {
var ( var (
color, _ = m.GetTag("color") color, _ = m.GetTag("color")
displayName, _ = m.GetTag("display-name") displayName, _ = m.GetTag("display-name")
emoteSets []int64 emoteSets []string
rawSets, _ = m.GetTag("emote-sets") rawSets, _ = m.GetTag("emote-sets")
) )
if rawSets != "" { if rawSets != "" {
for _, sid := range strings.Split(rawSets, ",") { emoteSets = strings.Split(rawSets, ",")
id, err := strconv.ParseInt(sid, 10, 64)
if err != nil {
return nil, errors.Wrap(err, "parsing emote-set id")
}
emoteSets = append(emoteSets, id)
}
} }
return &twitchUserState{ return &twitchUserState{