mirror of https://github.com/velour/catbase.git
Added some random sayings for the OCD bit of talker.
This commit is contained in:
parent
d50cf23522
commit
bc7a2c4847
|
@ -3,7 +3,9 @@ package plugins
|
||||||
import (
|
import (
|
||||||
"bitbucket.org/phlyingpenguin/godeepintir/bot"
|
"bitbucket.org/phlyingpenguin/godeepintir/bot"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TalkerPlugin struct {
|
type TalkerPlugin struct {
|
||||||
|
@ -36,7 +38,7 @@ func (p *TalkerPlugin) Message(message bot.Message) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *TalkerPlugin) LoadData() {
|
func (p *TalkerPlugin) LoadData() {
|
||||||
// no data to load yet?
|
rand.Seed(time.Now().Unix())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *TalkerPlugin) Help(channel string, parts []string) {
|
func (p *TalkerPlugin) Help(channel string, parts []string) {
|
||||||
|
@ -46,7 +48,11 @@ func (p *TalkerPlugin) Help(channel string, parts []string) {
|
||||||
// Empty event handler because this plugin does not do anything on event recv
|
// Empty event handler because this plugin does not do anything on event recv
|
||||||
func (p *TalkerPlugin) Event(kind string, message bot.Message) bool {
|
func (p *TalkerPlugin) Event(kind string, message bot.Message) bool {
|
||||||
if kind == "JOIN" && message.User.Name != p.Bot.Config.Nick {
|
if kind == "JOIN" && message.User.Name != p.Bot.Config.Nick {
|
||||||
msg := fmt.Sprintf("Joins upset the hivemind's OCD, %s.", message.User.Name)
|
sayings := []string{
|
||||||
|
"Real men use screen, flyngpngn.",
|
||||||
|
"Joins upset the hivemind's OCD, %s.",
|
||||||
|
}
|
||||||
|
msg := fmt.Sprintf(sayings[rand.Intn(len(sayings))], message.User.Name)
|
||||||
p.Bot.SendMessage(message.Channel, msg)
|
p.Bot.SendMessage(message.Channel, msg)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue