diff options
| author | ilotterytea <iltsu@alright.party> | 2025-10-14 16:46:58 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-10-14 16:46:58 +0500 |
| commit | e4c92920e627b7ad17f51637f52ca36e8468341f (patch) | |
| tree | 1fd96dca1bae51698e61b7d65f7b859643df1baf /cmd/statsbot | |
| parent | 33fd114a314212b8759b525fb9e08d4ff4ca8869 (diff) | |
feat: join channels in goroutine
Diffstat (limited to 'cmd/statsbot')
| -rw-r--r-- | cmd/statsbot/main.go | 8 |
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) |
