mirror of https://github.com/velour/catbase.git
sms: add skeleton
This commit is contained in:
parent
d5a2bec582
commit
280bb39125
2
main.go
2
main.go
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/velour/catbase/plugins/achievements"
|
||||
"github.com/velour/catbase/plugins/aoc"
|
||||
"github.com/velour/catbase/plugins/meme"
|
||||
"github.com/velour/catbase/plugins/sms"
|
||||
"github.com/velour/catbase/plugins/twitter"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
|
@ -142,6 +143,7 @@ func main() {
|
|||
b.AddPlugin(aoc.New(b))
|
||||
b.AddPlugin(meme.New(b))
|
||||
b.AddPlugin(achievements.New(b))
|
||||
b.AddPlugin(sms.New(b))
|
||||
// catches anything left, will always return true
|
||||
b.AddPlugin(fact.New(b))
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package sms
|
||||
|
||||
import (
|
||||
"github.com/velour/catbase/bot"
|
||||
"github.com/velour/catbase/bot/msg"
|
||||
"github.com/velour/catbase/config"
|
||||
)
|
||||
|
||||
type SMSPlugin struct {
|
||||
b bot.Bot
|
||||
c *config.Config
|
||||
}
|
||||
|
||||
func New(b bot.Bot) *SMSPlugin {
|
||||
sp := &SMSPlugin{
|
||||
b: b,
|
||||
c: b.Config(),
|
||||
}
|
||||
b.Register(sp, bot.Message, sp.message)
|
||||
b.Register(sp, bot.Help, sp.help)
|
||||
return sp
|
||||
}
|
||||
|
||||
func (p *SMSPlugin) message(c bot.Connector, kind bot.Kind, message msg.Message, args ...interface{}) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *SMSPlugin) help(c bot.Connector, kind bot.Kind, message msg.Message, args ...interface{}) bool {
|
||||
ch := message.Channel
|
||||
p.b.Send(c, bot.Message, ch, "There is no help for you.")
|
||||
return true
|
||||
}
|
Loading…
Reference in New Issue