sms: add skeleton

This commit is contained in:
Chris Sexton 2020-05-14 16:48:41 -04:00
parent d5a2bec582
commit b50d81b182
2 changed files with 34 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/velour/catbase/plugins/achievements" "github.com/velour/catbase/plugins/achievements"
"github.com/velour/catbase/plugins/aoc" "github.com/velour/catbase/plugins/aoc"
"github.com/velour/catbase/plugins/meme" "github.com/velour/catbase/plugins/meme"
"github.com/velour/catbase/plugins/sms"
"github.com/velour/catbase/plugins/twitter" "github.com/velour/catbase/plugins/twitter"
"github.com/rs/zerolog" "github.com/rs/zerolog"
@ -142,6 +143,7 @@ func main() {
b.AddPlugin(aoc.New(b)) b.AddPlugin(aoc.New(b))
b.AddPlugin(meme.New(b)) b.AddPlugin(meme.New(b))
b.AddPlugin(achievements.New(b)) b.AddPlugin(achievements.New(b))
b.AddPlugin(sms.New(b))
// catches anything left, will always return true // catches anything left, will always return true
b.AddPlugin(fact.New(b)) b.AddPlugin(fact.New(b))

32
plugins/sms/sms.go Normal file
View File

@ -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
}