summaryrefslogtreecommitdiff
path: root/cmd/statsbot/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/statsbot/main.go')
-rw-r--r--cmd/statsbot/main.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/cmd/statsbot/main.go b/cmd/statsbot/main.go
index 35e8f28..69fc7a5 100644
--- a/cmd/statsbot/main.go
+++ b/cmd/statsbot/main.go
@@ -11,6 +11,8 @@ import (
)
func main() {
+ channels := []stats.Channel{}
+
db, err := stats.NewDatabaseConnection("mysql", "kochan:kochan@/stats")
if err != nil {
log.Panicf("Failed to establish a database connection: %v\n", err)
@@ -27,11 +29,7 @@ func main() {
go stats.HandleMessageEvent(channel, user, message, db)
})
- channels, _ := db.Query("SELECT alias_name FROM channels WHERE opted_out_at IS NULL")
- for _, c := range channels {
- log.Printf("Joining #%s...\n", c["alias_name"])
- client.Join(c["alias_name"])
- }
+ go stats.JoinChannels(&channels, client, db)
if err := client.Connect(); err != nil {
log.Panicf("Failed to connect Twitch IRC: %v\n", err)