Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
Martyn 2020-06-30 17:30:05 +02:00
parent 34403053ac
commit f574863601
2 changed files with 48 additions and 48 deletions

View File

@ -181,6 +181,7 @@ func (bb *KardBot) HandleChat() error {
case "PRIVMSG":
msg := matches[4]
rgb.GPrintf("[%s] %s: %s\n", TimeStamp(), userName, msg)
rgb.GPrintf("[%s] raw line: %s\n", TimeStamp(), line)
// parse commands from user message
cmdMatches := CmdRegex.FindStringSubmatch(msg)

View File

@ -7,15 +7,15 @@ import (
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"encoding/json"
"fmt"
"html/template"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
"time"
"encoding/json"
"io/ioutil"
)
//var store = sessions.NewCookieStore(os.Getenv("SESSION_KEY"))
@ -205,7 +205,7 @@ func twitchHTTPClient(call string, bearer string) (string,error) {
func TwitchAdminHandler(response http.ResponseWriter, request *http.Request) {
vars := mux.Vars(request)
if (vars["code"] != "") {
if vars["code"] != "" {
response.Header().Add("Content-type", "text/plain")
resp, err := http.PostForm(
"https://id.twitch.tv/oauth2/token",
@ -270,11 +270,10 @@ func TwitchAdminHandler(response http.ResponseWriter, request *http.Request) {
url := "https://" + ircBot.Config.ExternalUrl + "/admin/" + user.Login + "/" + magicCode
http.Redirect(response, request, url, http.StatusFound)
} else {
fmt.Fprintf(response, "I'm not okay jack! %v \n", vars)
for key, val := range(vars) {
for key, val := range vars {
fmt.Fprint(response, "%s = %s\n", key, val)
}
}
@ -288,7 +287,7 @@ func TwitchBackendHandler(response http.ResponseWriter, request *http.Request){
// fmt.Fprint(response, "%s = %s\n", key, val)
// }
if (vars["code"] != "") {
if vars["code"] != "" {
// https://id.twitch.tv/oauth2/token
// ?client_id=<your client ID>
// &client_secret=<your client secret>