mirror of https://github.com/velour/catbase.git
Improve talker to disable nick length constraints
This commit is contained in:
parent
003c0fb8eb
commit
25f32918b1
|
@ -28,6 +28,7 @@ type Config struct {
|
|||
UntappdToken string
|
||||
UntappdFreq int
|
||||
UntappdChannels []string
|
||||
EnforceNicks bool
|
||||
WelcomeMsgs []string
|
||||
TwitterConsumerKey string
|
||||
TwitterConsumerSecret string
|
||||
|
|
|
@ -4,10 +4,11 @@ package plugins
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/chrissexton/alepale/bot"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/chrissexton/alepale/bot"
|
||||
)
|
||||
|
||||
var goatse []string = []string{
|
||||
|
@ -40,11 +41,13 @@ var goatse []string = []string{
|
|||
|
||||
type TalkerPlugin struct {
|
||||
Bot *bot.Bot
|
||||
enforceNicks bool
|
||||
}
|
||||
|
||||
func NewTalkerPlugin(bot *bot.Bot) *TalkerPlugin {
|
||||
return &TalkerPlugin{
|
||||
Bot: bot,
|
||||
enforceNicks: bot.Config.EnforceNicks,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +56,7 @@ func (p *TalkerPlugin) Message(message bot.Message) bool {
|
|||
body := message.Body
|
||||
lowermessage := strings.ToLower(body)
|
||||
|
||||
// TODO: This ought to be space split afterwards to remove any punctuation
|
||||
if strings.HasPrefix(lowermessage, "say") {
|
||||
msg := strings.TrimSpace(body[3:])
|
||||
p.Bot.SendMessage(channel, msg)
|
||||
|
@ -73,7 +77,7 @@ func (p *TalkerPlugin) Message(message bot.Message) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
if len(message.User.Name) != 9 {
|
||||
if p.enforceNicks && len(message.User.Name) != 9 {
|
||||
msg := fmt.Sprintf("Hey %s, we really like to have 9 character nicks because we're crazy OCD and stuff.",
|
||||
message.User.Name)
|
||||
p.Bot.SendMessage(message.Channel, msg)
|
||||
|
|
Loading…
Reference in New Issue