stats: I am retarded.

This commit is contained in:
Hamcha 2016-02-13 23:59:24 +01:00
parent 1389b5dc40
commit 6ad3dd7ce0

View file

@ -318,22 +318,10 @@ func processWords(message tg.APIMessage) {
err := db.Update(func(tx *bolt.Tx) error { err := db.Update(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte("words")) b := tx.Bucket([]byte("words"))
for _, word := range wordList { for _, word := range wordList {
if len(word) < 3 { count, ok := words[word]
continue if !ok {
}
data := b.Get([]byte(word))
var count UserCount
if data == nil {
count = make(UserCount) count = make(UserCount)
} else {
err := json.Unmarshal(data, &count)
if err != nil {
return err
} }
}
val, ok := count[message.User.Username] val, ok := count[message.User.Username]
if !ok { if !ok {
val = 0 val = 0