diff options
| author | ilotterytea <iltsu@alright.party> | 2025-10-13 00:17:36 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-10-13 00:17:36 +0500 |
| commit | 9533a34322c5ec154860c42af98e0d4e8d44d945 (patch) | |
| tree | f91b0d4adb2c3db6b27fa922b7742384b2eea11b /cmd | |
| parent | 976b0683324813b2bcbda391a83188489be3d5ad (diff) | |
feat: save words into the database
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/statsbot/main.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/statsbot/main.go b/cmd/statsbot/main.go index e7fd098..35e8f28 100644 --- a/cmd/statsbot/main.go +++ b/cmd/statsbot/main.go @@ -6,12 +6,14 @@ import ( "github.com/gempir/go-twitch-irc" stats "ilotterytea/tinystats/internal" + + _ "github.com/go-sql-driver/mysql" ) func main() { db, err := stats.NewDatabaseConnection("mysql", "kochan:kochan@/stats") if err != nil { - log.Panicf("Failed to establish database connection: %v\n", err) + log.Panicf("Failed to establish a database connection: %v\n", err) } defer db.Close() @@ -22,7 +24,7 @@ func main() { }) client.OnNewMessage(func(channel string, user twitch.User, message twitch.Message) { - log.Printf("Message: %s\n", message.Text) + go stats.HandleMessageEvent(channel, user, message, db) }) channels, _ := db.Query("SELECT alias_name FROM channels WHERE opted_out_at IS NULL") |
