mirror of https://github.com/velour/catbase.git
Fix goatse in talker
Note: This makes the goatse very Slack specific with preformatting and newlines.
This commit is contained in:
parent
3cdb40ab5c
commit
0e69e58ff5
2
main.go
2
main.go
|
@ -46,7 +46,7 @@ func main() {
|
|||
// b.AddHandler("first", plugins.NewFirstPlugin(b))
|
||||
b.AddHandler("leftpad", leftpad.New(b))
|
||||
b.AddHandler("downtime", downtime.NewDowntimePlugin(b))
|
||||
b.AddHandler("talker", talker.NewTalkerPlugin(b))
|
||||
b.AddHandler("talker", talker.New(b))
|
||||
b.AddHandler("dice", dice.NewDicePlugin(b))
|
||||
b.AddHandler("beers", beers.NewBeersPlugin(b))
|
||||
b.AddHandler("counter", counter.NewCounterPlugin(b))
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
var goatse []string = []string{
|
||||
"* g o a t s e x * g o a t s e x * g o a t s e x *",
|
||||
"```* g o a t s e x * g o a t s e x * g o a t s e x *",
|
||||
"g g",
|
||||
"o / \\ \\ / \\ o",
|
||||
"a| | \\ | | a",
|
||||
|
@ -36,7 +36,7 @@ var goatse []string = []string{
|
|||
"s | / / \\__/\\___/ | |s",
|
||||
"e | / | | | |e",
|
||||
"x | | | | | |x",
|
||||
"* g o a t s e x * g o a t s e x * g o a t s e x *",
|
||||
"* g o a t s e x * g o a t s e x * g o a t s e x *```",
|
||||
}
|
||||
|
||||
type TalkerPlugin struct {
|
||||
|
@ -44,7 +44,7 @@ type TalkerPlugin struct {
|
|||
enforceNicks bool
|
||||
}
|
||||
|
||||
func NewTalkerPlugin(bot *bot.Bot) *TalkerPlugin {
|
||||
func New(bot *bot.Bot) *TalkerPlugin {
|
||||
return &TalkerPlugin{
|
||||
Bot: bot,
|
||||
enforceNicks: bot.Config.EnforceNicks,
|
||||
|
@ -69,11 +69,13 @@ func (p *TalkerPlugin) Message(message bot.Message) bool {
|
|||
nick = parts[1]
|
||||
}
|
||||
|
||||
output := ""
|
||||
for _, line := range goatse {
|
||||
nick = fmt.Sprintf("%9.9s", nick)
|
||||
line = strings.Replace(line, "{nick}", nick, 1)
|
||||
p.Bot.SendMessage(channel, line)
|
||||
output += line + "\n"
|
||||
}
|
||||
p.Bot.SendMessage(channel, output)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue