stats: I am retarded.
This commit is contained in:
parent
1389b5dc40
commit
6ad3dd7ce0
1 changed files with 2 additions and 14 deletions
|
@ -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
|
||||||
|
|
Reference in a new issue