catbase/plugins/rpgORdie/rpgORdie.go

60 lines
1.1 KiB
Go
Raw Normal View History

package rpgORdie
import (
"strings"
// "log"
"time"
"github.com/velour/catbase/bot"
"github.com/velour/catbase/bot/msg"
)
type RPGPlugin struct {
2017-10-31 13:40:03 +00:00
Bot bot.Bot
}
func New(b bot.Bot) *RPGPlugin {
return &RPGPlugin{
2017-10-31 13:40:03 +00:00
Bot: b,
}
}
func (p *RPGPlugin) Message(message msg.Message) bool {
if strings.ToLower(message.Body) == "start rpg" {
2017-10-31 13:40:03 +00:00
ts := p.Bot.SendMessage(message.Channel, "I'll edit this.")
time.Sleep(2 * time.Second)
edited := ""
for i := 0; i <= 5; i++ {
p.Bot.Edit(message.Channel, edited, ts)
edited += ":fire:"
time.Sleep(2 * time.Second)
}
p.Bot.Edit(message.Channel, "HECK YES", ts)
2017-10-31 14:07:20 +00:00
p.Bot.ReplyToMessageIdentifier(message.Channel, "How's this reply?", ts)
}
return false
}
func (p *RPGPlugin) LoadData() {
}
func (p *RPGPlugin) Help(channel string, parts []string) {
p.Bot.SendMessage(channel, "Go find a walkthrough or something.")
}
func (p *RPGPlugin) Event(kind string, message msg.Message) bool {
return false
}
func (p *RPGPlugin) BotMessage(message msg.Message) bool {
return false
}
func (p *RPGPlugin) RegisterWeb() *string {
return nil
}