stats: Actually initialize the word maps
This commit is contained in:
parent
0a117e7918
commit
1389b5dc40
1 changed files with 7 additions and 3 deletions
|
@ -325,9 +325,13 @@ func processWords(message tg.APIMessage) {
|
||||||
data := b.Get([]byte(word))
|
data := b.Get([]byte(word))
|
||||||
|
|
||||||
var count UserCount
|
var count UserCount
|
||||||
err := json.Unmarshal(data, &count)
|
if data == nil {
|
||||||
if err != nil {
|
count = make(UserCount)
|
||||||
return err
|
} else {
|
||||||
|
err := json.Unmarshal(data, &count)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val, ok := count[message.User.Username]
|
val, ok := count[message.User.Username]
|
||||||
|
|
Reference in a new issue