add debug command

This commit is contained in:
lyx0 2022-08-10 02:18:39 +02:00
parent b91dc8d60a
commit 998ad5c907
2 changed files with 27 additions and 0 deletions

View file

@ -87,6 +87,18 @@ func (app *Application) handleCommand(message twitch.PrivateMessage) {
} else {
return
}
case "debug": // ()edituser level nourylul 1000
if message.User.ID != "31437432" { // Limit to myself for now.
return
} else if msgLen < 3 {
common.Send(target, "Not enough arguments provided.", app.TwitchClient)
return
} else if cmdParams[1] == "user" {
app.DebugUser(cmdParams[2], message)
return
} else {
return
}
case "deletechannel":
if message.User.ID != "31437432" { // Limit to myself for now.
return

View file

@ -43,6 +43,21 @@ func (app *Application) AddUser(login, lvl string, message twitch.PrivateMessage
}
}
func (app *Application) DebugUser(login string, message twitch.PrivateMessage) {
user, err := app.Models.Users.Get(login)
if err != nil {
reply := fmt.Sprintf("Something went wrong FeelsBadMan %s", err)
common.Send(message.Channel, reply, app.TwitchClient)
return
} else {
reply := fmt.Sprintf("User %v: ID %v, Login: %s, TwitchID: %v, Level %v", login, user.ID, user.Login, user.TwitchID, user.Level)
common.Send(message.Channel, reply, app.TwitchClient)
app.TwitchClient.Whisper(message.User.Name, reply)
return
}
}
func (app *Application) DeleteUser(login string, message twitch.PrivateMessage) {
err := app.Models.Users.Delete(login)
if err != nil {