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)
|
reply := fmt.Sprintf("Something went wrong FeelsBadMan %s", err)
|
||||||
app.Send(message.Channel, reply)
|
app.Send(message.Channel, reply)
|
||||||
return
|
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 {
|
} else {
|
||||||
reply := fmt.Sprintf("id=%v\nname=%v\nlevel=%v\ncategory=%v\ntext=%v\nhelp=%v\n",
|
reply := fmt.Sprintf("id=%v\nname=%v\nlevel=%v\ncategory=%v\ntext=%v\nhelp=%v\n",
|
||||||
cmd.ID,
|
cmd.ID,
|
||||||
|
@ -204,7 +184,7 @@ func (app *application) DebugCommand(name string, message twitch.PrivateMessage)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
app.Send(message.Channel, resp)
|
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
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
@ -14,8 +13,8 @@ import (
|
||||||
// this whole function was pretty much yoinked from here
|
// this whole function was pretty much yoinked from here
|
||||||
// https://github.com/zneix/haste-client/blob/master/main.go <3
|
// https://github.com/zneix/haste-client/blob/master/main.go <3
|
||||||
func (app *application) uploadPaste(text string) (string, error) {
|
func (app *application) uploadPaste(text string) (string, error) {
|
||||||
var hasteURL = "https://haste.noury.ee"
|
const hasteURL = "https://haste.noury.cc"
|
||||||
var apiRoute = "/documents"
|
const apiRoute = "/documents"
|
||||||
var httpClient = &http.Client{Timeout: 10 * time.Second}
|
var httpClient = &http.Client{Timeout: 10 * time.Second}
|
||||||
|
|
||||||
type pasteResponse struct {
|
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))
|
req, err := http.NewRequest("POST", hasteURL+apiRoute, bytes.NewBufferString(text))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Log.Error("Could not upload paste:", err)
|
app.Log.Errorln("Could not upload paste:", err)
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("User-Agent", fmt.Sprintf("nourybot"))
|
req.Header.Set("User-Agent", "nourybot")
|
||||||
|
|
||||||
resp, err := httpClient.Do(req)
|
resp, err := httpClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.Log.Error("Error while sending HTTP request:", err)
|
app.Log.Errorln("Error while sending HTTP request:", err)
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
@ -50,7 +49,7 @@ func (app *application) uploadPaste(text string) (string, error) {
|
||||||
|
|
||||||
jsonResponse := new(pasteResponse)
|
jsonResponse := new(pasteResponse)
|
||||||
if err := json.Unmarshal(body, jsonResponse); err != nil {
|
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
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ func (app *application) DebugUser(login string, message twitch.PrivateMessage) {
|
||||||
app.Send(message.Channel, reply)
|
app.Send(message.Channel, reply)
|
||||||
return
|
return
|
||||||
} else {
|
} 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",
|
body := fmt.Sprintf("id=%v \nlogin=%v \nlevel=%v \nlocation=%v \nlastfm=%v",
|
||||||
user.TwitchID,
|
user.TwitchID,
|
||||||
user.Login,
|
user.Login,
|
||||||
|
@ -46,7 +46,7 @@ func (app *application) DebugUser(login string, message twitch.PrivateMessage) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
app.Send(message.Channel, resp)
|
app.Send(message.Channel, resp)
|
||||||
app.SendEmail(subject, body)
|
// app.SendEmail(subject, body)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue