From 800b837f55310854e15ea206a6a382db23b729b2 Mon Sep 17 00:00:00 2001 From: lyx0 Date: Sat, 16 Sep 2023 19:39:10 +0200 Subject: [PATCH] remove email debugs --- cmd/nourybot/command.go | 22 +--------------------- cmd/nourybot/paste.go | 13 ++++++------- cmd/nourybot/user.go | 4 ++-- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/cmd/nourybot/command.go b/cmd/nourybot/command.go index d3beac4..c02487e 100644 --- a/cmd/nourybot/command.go +++ b/cmd/nourybot/command.go @@ -166,26 +166,6 @@ func (app *application) DebugCommand(name string, message twitch.PrivateMessage) reply := fmt.Sprintf("Something went wrong FeelsBadMan %s", err) app.Send(message.Channel, reply) return - } else if cmd.Category == "ascii" { - // If the command is in the ascii category don't post the Text field - // otherwise it becomes too spammy and won't fit in the max message length. - reply := fmt.Sprintf("id=%v\nname=%v\nlevel=%v\ncategory=%v\nhelp=%v\n", - cmd.ID, - cmd.Name, - cmd.Level, - cmd.Category, - cmd.Help, - ) - - resp, err := app.uploadPaste(reply) - if err != nil { - app.Log.Errorln("Could not upload paste:", err) - app.Send(message.Channel, "Something went wrong FeelsBadMan") - return - } - app.Send(message.Channel, resp) - app.SendEmail(fmt.Sprintf("DEBUG for command %s", name), reply) - return } else { reply := fmt.Sprintf("id=%v\nname=%v\nlevel=%v\ncategory=%v\ntext=%v\nhelp=%v\n", cmd.ID, @@ -204,7 +184,7 @@ func (app *application) DebugCommand(name string, message twitch.PrivateMessage) return } app.Send(message.Channel, resp) - app.SendEmail(fmt.Sprintf("DEBUG for command %s", name), reply) + //app.SendEmail(fmt.Sprintf("DEBUG for command %s", name), reply) return } } diff --git a/cmd/nourybot/paste.go b/cmd/nourybot/paste.go index 7013a28..9b37b13 100644 --- a/cmd/nourybot/paste.go +++ b/cmd/nourybot/paste.go @@ -3,7 +3,6 @@ package main import ( "bytes" "encoding/json" - "fmt" "io" "net/http" "time" @@ -14,8 +13,8 @@ import ( // this whole function was pretty much yoinked from here // https://github.com/zneix/haste-client/blob/master/main.go <3 func (app *application) uploadPaste(text string) (string, error) { - var hasteURL = "https://haste.noury.ee" - var apiRoute = "/documents" + const hasteURL = "https://haste.noury.cc" + const apiRoute = "/documents" var httpClient = &http.Client{Timeout: 10 * time.Second} type pasteResponse struct { @@ -24,15 +23,15 @@ func (app *application) uploadPaste(text string) (string, error) { req, err := http.NewRequest("POST", hasteURL+apiRoute, bytes.NewBufferString(text)) if err != nil { - app.Log.Error("Could not upload paste:", err) + app.Log.Errorln("Could not upload paste:", err) return "", err } - req.Header.Set("User-Agent", fmt.Sprintf("nourybot")) + req.Header.Set("User-Agent", "nourybot") resp, err := httpClient.Do(req) if err != nil { - app.Log.Error("Error while sending HTTP request:", err) + app.Log.Errorln("Error while sending HTTP request:", err) return "", err } defer resp.Body.Close() @@ -50,7 +49,7 @@ func (app *application) uploadPaste(text string) (string, error) { jsonResponse := new(pasteResponse) if err := json.Unmarshal(body, jsonResponse); err != nil { - app.Log.Fatalln("Error while unmarshalling JSON response:", err) + app.Log.Errorln("Error while unmarshalling JSON response:", err) return "", err } diff --git a/cmd/nourybot/user.go b/cmd/nourybot/user.go index b0f64ef..a67d14e 100644 --- a/cmd/nourybot/user.go +++ b/cmd/nourybot/user.go @@ -30,7 +30,7 @@ func (app *application) DebugUser(login string, message twitch.PrivateMessage) { app.Send(message.Channel, reply) return } else { - subject := fmt.Sprintf("DEBUG for user %v", login) + // subject := fmt.Sprintf("DEBUG for user %v", login) body := fmt.Sprintf("id=%v \nlogin=%v \nlevel=%v \nlocation=%v \nlastfm=%v", user.TwitchID, user.Login, @@ -46,7 +46,7 @@ func (app *application) DebugUser(login string, message twitch.PrivateMessage) { return } app.Send(message.Channel, resp) - app.SendEmail(subject, body) + // app.SendEmail(subject, body) return } }