mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
remove email debugs
This commit is contained in:
parent
90031bfe40
commit
800b837f55
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue