add way to delete commands

This commit is contained in:
lyx0 2022-08-11 21:49:15 +02:00
parent 58ad0b3e20
commit 704a6a9470

View file

@ -67,7 +67,6 @@ func (app *Application) GetCommand(name, username string) (string, error) {
}
func (app *Application) EditCommandLevel(name, lvl string, message twitch.PrivateMessage) {
level, err := strconv.Atoi(lvl)
if err != nil {
app.Logger.Error(err)
@ -87,3 +86,15 @@ func (app *Application) EditCommandLevel(name, lvl string, message twitch.Privat
return
}
}
func (app *Application) DeleteCommand(name string, message twitch.PrivateMessage) {
err := app.Models.Commands.Delete(name)
if err != nil {
common.Send(message.Channel, "Something went wrong FeelsBadMan", app.TwitchClient)
app.Logger.Error(err)
return
}
reply := fmt.Sprintf("Deleted command %s", name)
common.Send(message.Channel, reply, app.TwitchClient)
}