stats-import: It's fine, make the module 'whole' again

This commit is contained in:
Hamcha 2016-02-14 10:44:00 +01:00
parent e2e2e5aae0
commit bf7f2b6b55

View file

@ -7,7 +7,9 @@ import (
"flag"
"log"
"os"
"strconv"
"strings"
"time"
"github.com/boltdb/bolt"
)
@ -87,7 +89,6 @@ func main() {
}
func processMessage(msg Message, data *Stats) {
/*
data.Total++
if msg.ReplyID != nil {
@ -117,7 +118,7 @@ func processMessage(msg Message, data *Stats) {
data.ByDate[datekey] = val + 1
data.Username[msg.From.Username] = msg.From.FirstName
*/
if len(msg.Text) > 2 {
wordList := strings.Split(msg.Text, " ")
for _, word := range wordList {
@ -169,7 +170,6 @@ func PutUint(value uint64) []byte {
func update(db *bolt.DB, data Stats) error {
return db.Update(func(tx *bolt.Tx) error {
/*
b, err := tx.CreateBucketIfNotExists([]byte("global"))
if err != nil {
return err
@ -279,9 +279,9 @@ func update(db *bolt.DB, data Stats) error {
}
}
}
*/
// Add word frequency
b, err := tx.CreateBucketIfNotExists([]byte("words"))
b, err = tx.CreateBucketIfNotExists([]byte("words"))
if err != nil {
return err
}