mirror of https://github.com/velour/catbase.git
help: fix the help system after I borke it
* Also fix twitch's help registration and message
This commit is contained in:
parent
d569810db6
commit
32ca0c5bf7
|
@ -64,6 +64,7 @@ func (b *bot) checkHelp(channel string, parts []string) {
|
||||||
// just print out a list of help topics
|
// just print out a list of help topics
|
||||||
topics := "Help topics: about variables"
|
topics := "Help topics: about variables"
|
||||||
for name, _ := range b.plugins {
|
for name, _ := range b.plugins {
|
||||||
|
name = strings.Split(strings.TrimPrefix(name, "*"), ".")[0]
|
||||||
topics = fmt.Sprintf("%s, %s", topics, name)
|
topics = fmt.Sprintf("%s, %s", topics, name)
|
||||||
}
|
}
|
||||||
b.Send(Message, channel, topics)
|
b.Send(Message, channel, topics)
|
||||||
|
@ -77,15 +78,21 @@ func (b *bot) checkHelp(channel string, parts []string) {
|
||||||
b.listVars(channel, parts)
|
b.listVars(channel, parts)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
plugin, ok := b.plugins[parts[1]]
|
for name, plugin := range b.plugins {
|
||||||
if ok {
|
if strings.HasPrefix(name, "*"+parts[1]) {
|
||||||
b.runCallback(plugin, Help, msg.Message{Channel: channel}, channel, parts)
|
if b.runCallback(plugin, Help, msg.Message{Channel: channel}, channel, parts) {
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
msg := fmt.Sprintf("I'm sorry, I don't know what %s is!", parts[1])
|
msg := fmt.Sprintf("I'm sorry, I don't know how to help you with %s.", parts[1])
|
||||||
b.Send(Message, channel, msg)
|
b.Send(Message, channel, msg)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
msg := fmt.Sprintf("I'm sorry, I don't know what %s is!", strings.Join(parts, " "))
|
||||||
|
b.Send(Message, channel, msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (b *bot) LastMessage(channel string) (msg.Message, error) {
|
func (b *bot) LastMessage(channel string) (msg.Message, error) {
|
||||||
log := <-b.logOut
|
log := <-b.logOut
|
||||||
|
|
|
@ -78,6 +78,7 @@ func New(b bot.Bot) *TwitchPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
b.Register(p, bot.Message, p.message)
|
b.Register(p, bot.Message, p.message)
|
||||||
|
b.Register(p, bot.Help, p.help)
|
||||||
p.registerWeb()
|
p.registerWeb()
|
||||||
|
|
||||||
return p
|
return p
|
||||||
|
@ -144,6 +145,7 @@ func (p *TwitchPlugin) help(kind bot.Kind, message msg.Message, args ...interfac
|
||||||
msg += fmt.Sprintf("twitch.istpl (default: %s)\n", isStreamingTplFallback)
|
msg += fmt.Sprintf("twitch.istpl (default: %s)\n", isStreamingTplFallback)
|
||||||
msg += fmt.Sprintf("twitch.nottpl (default: %s)\n", notStreamingTplFallback)
|
msg += fmt.Sprintf("twitch.nottpl (default: %s)\n", notStreamingTplFallback)
|
||||||
msg += fmt.Sprintf("twitch.stoppedtpl (default: %s)\n", stoppedStreamingTplFallback)
|
msg += fmt.Sprintf("twitch.stoppedtpl (default: %s)\n", stoppedStreamingTplFallback)
|
||||||
|
msg += "You can reset all messages with `!reset twitch`"
|
||||||
msg += "And you can ask who is streaming with `!twitch status`"
|
msg += "And you can ask who is streaming with `!twitch status`"
|
||||||
p.Bot.Send(bot.Message, message.Channel, msg)
|
p.Bot.Send(bot.Message, message.Channel, msg)
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue