mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
add eventsub debug command
This commit is contained in:
parent
e9c9118321
commit
efc5793849
|
@ -179,7 +179,6 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
|
||||||
}
|
}
|
||||||
case "ping":
|
case "ping":
|
||||||
reply = commands.Ping(app.Environment)
|
reply = commands.Ping(app.Environment)
|
||||||
// ()bttv <emote name>
|
|
||||||
|
|
||||||
// ()weather <location>
|
// ()weather <location>
|
||||||
case "weather":
|
case "weather":
|
||||||
|
@ -267,6 +266,10 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
|
||||||
if userLevel >= 100 {
|
if userLevel >= 100 {
|
||||||
app.DebugChannelTimers(message.Channel)
|
app.DebugChannelTimers(message.Channel)
|
||||||
}
|
}
|
||||||
|
case "eventsub":
|
||||||
|
if userLevel >= 1000 {
|
||||||
|
reply = app.listEventSubSubscriptions()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
|
@ -388,11 +391,21 @@ func (app *application) handleCommand(message twitch.PrivateMessage) {
|
||||||
app.ConvertAndSave(cmdParams[1], cmdParams[2], message)
|
app.ConvertAndSave(cmdParams[1], cmdParams[2], message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "echo":
|
||||||
|
if userLevel >= 1000 {
|
||||||
|
reply = message.Message[7:len(message.Message)]
|
||||||
|
}
|
||||||
|
|
||||||
case "say":
|
case "say":
|
||||||
if userLevel >= 1000 {
|
if userLevel >= 1000 {
|
||||||
reply = message.Message[6:len(message.Message)]
|
reply = message.Message[6:len(message.Message)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// case "whisper":
|
||||||
|
// if userLevel >= 1000 {
|
||||||
|
// go app.sendWhisper(cmdParams[1], message.Message[10:len(message.Message)])
|
||||||
|
// }
|
||||||
|
|
||||||
case "join":
|
case "join":
|
||||||
if userLevel >= 1000 {
|
if userLevel >= 1000 {
|
||||||
go app.AddChannel(cmdParams[1], message)
|
go app.AddChannel(cmdParams[1], message)
|
||||||
|
@ -495,6 +508,13 @@ var helpText = map[string]command{
|
||||||
Level: "0",
|
Level: "0",
|
||||||
Usage: "()commands",
|
Usage: "()commands",
|
||||||
},
|
},
|
||||||
|
"conv": {
|
||||||
|
Name: "conv",
|
||||||
|
Alias: nil,
|
||||||
|
Description: "Converts the linked video into an .mp4 file.",
|
||||||
|
Level: "1000",
|
||||||
|
Usage: "()conv <video link>",
|
||||||
|
},
|
||||||
"currency": {
|
"currency": {
|
||||||
Name: "currency",
|
Name: "currency",
|
||||||
Alias: []string{"currency", "money"},
|
Alias: []string{"currency", "money"},
|
||||||
|
@ -509,6 +529,13 @@ var helpText = map[string]command{
|
||||||
Level: "100",
|
Level: "100",
|
||||||
Usage: "()debug env",
|
Usage: "()debug env",
|
||||||
},
|
},
|
||||||
|
"debug eventsub": {
|
||||||
|
Name: "debug eventsub",
|
||||||
|
Alias: nil,
|
||||||
|
Description: "Returns information about current eventsub subscriptions.",
|
||||||
|
Level: "1000",
|
||||||
|
Usage: "()debug eventsub",
|
||||||
|
},
|
||||||
"debug user": {
|
"debug user": {
|
||||||
Name: "debug user",
|
Name: "debug user",
|
||||||
Alias: nil,
|
Alias: nil,
|
||||||
|
@ -614,6 +641,13 @@ var helpText = map[string]command{
|
||||||
Level: "0",
|
Level: "0",
|
||||||
Usage: "()lastfm [username]",
|
Usage: "()lastfm [username]",
|
||||||
},
|
},
|
||||||
|
"meme": {
|
||||||
|
Name: "meme",
|
||||||
|
Alias: nil,
|
||||||
|
Description: "Downloads the linked video and saves it with the specified name in .mp4 format.",
|
||||||
|
Level: "1000",
|
||||||
|
Usage: "()meme <name> <video link>",
|
||||||
|
},
|
||||||
"notify live": {
|
"notify live": {
|
||||||
Name: "notify live",
|
Name: "notify live",
|
||||||
Alias: nil,
|
Alias: nil,
|
||||||
|
@ -670,6 +704,13 @@ var helpText = map[string]command{
|
||||||
Level: "0",
|
Level: "0",
|
||||||
Usage: "()randomxkcd",
|
Usage: "()randomxkcd",
|
||||||
},
|
},
|
||||||
|
"say": {
|
||||||
|
Name: "say",
|
||||||
|
Alias: []string{"say", "echo"},
|
||||||
|
Description: "Makes the bot say something.",
|
||||||
|
Level: "1000",
|
||||||
|
Usage: "()say xD",
|
||||||
|
},
|
||||||
"seventv": {
|
"seventv": {
|
||||||
Name: "seventv",
|
Name: "seventv",
|
||||||
Alias: []string{"seventv", "7tv"},
|
Alias: []string{"seventv", "7tv"},
|
||||||
|
|
|
@ -194,3 +194,25 @@ func (app *application) deleteOfflineSubscription(target, channel string) string
|
||||||
app.Log.Infof("%+v\n", resp2)
|
app.Log.Infof("%+v\n", resp2)
|
||||||
return fmt.Sprintf("Successfully deleted live notification for channel %s; id=%v", channel, uid)
|
return fmt.Sprintf("Successfully deleted live notification for channel %s; id=%v", channel, uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// createLiveSubscription creates a stream.online twitch eventsub subscription for the specified channel
|
||||||
|
func (app *application) listEventSubSubscriptions() string {
|
||||||
|
resp, err := app.HelixClient.GetEventSubSubscriptions(&helix.EventSubSubscriptionsParams{})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
app.Log.Errorw("Error listing Eventsub subscriptions",
|
||||||
|
"resp", resp,
|
||||||
|
"err", err,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
app.Log.Infof("%+v\n", resp)
|
||||||
|
|
||||||
|
link, err := app.uploadPaste(fmt.Sprint(resp))
|
||||||
|
if err != nil {
|
||||||
|
app.Log.Errorw("Error creating paste",
|
||||||
|
"err", err,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
app.Log.Info(link)
|
||||||
|
return fmt.Sprintf("Subscriptions: asdad")
|
||||||
|
}
|
||||||
|
|
|
@ -79,3 +79,22 @@ func (app *application) getChannelGameByUsername(username string) string {
|
||||||
reply := app.getChannelGame(channelID)
|
reply := app.getChannelGame(channelID)
|
||||||
return reply
|
return reply
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//func (app *application) sendWhisper(username, text string) {
|
||||||
|
// toID, err := app.getUserID(username)
|
||||||
|
// if err != nil {
|
||||||
|
// app.Log.Error(err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// resp, err := app.HelixClient.SendUserWhisper(&helix.SendUserWhisperParams{
|
||||||
|
// FromUserID: "mycoolid",
|
||||||
|
// ToUserID: toID,
|
||||||
|
// Message: text,
|
||||||
|
// })
|
||||||
|
// if err != nil {
|
||||||
|
// app.Log.Error(err)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// app.Log.Infof("%+v\n", resp)
|
||||||
|
//}
|
||||||
|
|
Loading…
Reference in a new issue