From 6448c71fc12a093feffb94f21e16543290c6895d Mon Sep 17 00:00:00 2001 From: lyx0 <66651385+lyx0@users.noreply.github.com> Date: Fri, 3 Mar 2023 21:34:52 +0000 Subject: [PATCH] remove environment config variable --- cmd/bot/commands.go | 18 +++++++++--------- cmd/bot/main.go | 9 +++++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/cmd/bot/commands.go b/cmd/bot/commands.go index 18f41f9..e552f31 100644 --- a/cmd/bot/commands.go +++ b/cmd/bot/commands.go @@ -45,15 +45,15 @@ func (app *Application) handleCommand(message twitch.PrivateMessage) { // If the level returned is 0 then the user was not found in the database. userLevel := app.GetUserLevel(message.User.Name) - // app.Logger.Infow("Command received", - // // "message", message, // Pretty taxing - // "message.Message", message.Message, - // "message.Channel", target, - // "userLevel", userLevel, - // "commandName", commandName, - // "cmdParams", cmdParams, - // "msgLen", msgLen, - // ) + app.Logger.Infow("Command received", + // "message", message, // Pretty taxing + "message.Message", message.Message, + "message.Channel", target, + "userLevel", userLevel, + "commandName", commandName, + "cmdParams", cmdParams, + "msgLen", msgLen, + ) // A `commandName` is every message starting with `()`. // Hardcoded commands have a priority over database commands. diff --git a/cmd/bot/main.go b/cmd/bot/main.go index 744d5e4..bcd159e 100644 --- a/cmd/bot/main.go +++ b/cmd/bot/main.go @@ -24,7 +24,6 @@ type config struct { twitchClientId string twitchClientSecret string commandPrefix string - environment string db struct { dsn string maxOpenConns int @@ -127,6 +126,12 @@ func main() { // Received a PrivateMessage (normal chat message). app.TwitchClient.OnPrivateMessage(func(message twitch.PrivateMessage) { + app.Logger.Infow("Message received", + "message", message, + "message.User.DisplayName", message.User.DisplayName, + "message.Message", message.Message, + ) + // roomId is the Twitch UserID of the channel the message originated from. // If there is no roomId something went really wrong. roomId := message.Tags["room-id"] @@ -163,7 +168,7 @@ func main() { app.TwitchClient.OnConnect(func() { app.Logger.Infow("Successfully connected to Twitch Servers", "Bot username", cfg.twitchUsername, - "Environment", cfg.environment, + "Environment", envFlag, "Database Open Conns", cfg.db.maxOpenConns, "Database Idle Conns", cfg.db.maxIdleConns, "Database Idle Time", cfg.db.maxIdleTime,