mirror of https://github.com/velour/catbase.git
Moved welcome messages to config file for easier updating
This commit is contained in:
parent
172567004a
commit
0552c5048d
|
@ -18,6 +18,12 @@
|
|||
|
||||
"comment": "Follows is the old bot",
|
||||
|
||||
"WelcomeMsgs": [
|
||||
"Real men use screen, %s.",
|
||||
"Joins upset the hivemind's OCD, %s.",
|
||||
"Joins upset the hivemind's CDO, %s.",
|
||||
],
|
||||
|
||||
"bot": {
|
||||
"dbname": "deepintir",
|
||||
"inchan": "out",
|
||||
|
|
|
@ -21,6 +21,7 @@ type Config struct {
|
|||
Admins []string
|
||||
UntappdToken string
|
||||
UntappdFreq int
|
||||
WelcomeMsgs []string
|
||||
}
|
||||
|
||||
// Readconfig loads the config data out of a JSON file located in cfile
|
||||
|
|
|
@ -55,11 +55,7 @@ func (p *TalkerPlugin) Help(channel string, parts []string) {
|
|||
// Empty event handler because this plugin does not do anything on event recv
|
||||
func (p *TalkerPlugin) Event(kind string, message bot.Message) bool {
|
||||
if kind == "JOIN" && message.User.Name != p.Bot.Config.Nick {
|
||||
sayings := []string{
|
||||
"Real men use screen, %s.",
|
||||
"Joins upset the hivemind's OCD, %s.",
|
||||
"Joins upset the hivemind's CDO, %s.",
|
||||
}
|
||||
sayings := p.Bot.Config.WelcomeMsgs
|
||||
msg := fmt.Sprintf(sayings[rand.Intn(len(sayings))], message.User.Name)
|
||||
p.Bot.SendMessage(message.Channel, msg)
|
||||
return true
|
||||
|
|
Loading…
Reference in New Issue