mirror of https://github.com/velour/catbase.git
Fix a few minor govet issues
This commit is contained in:
parent
624d96a10c
commit
b6d63f6432
|
@ -84,7 +84,7 @@ func (p *CounterPlugin) Message(message bot.Message) bool {
|
||||||
}
|
}
|
||||||
resp = fmt.Sprintf("%s %s: %d", resp, it.Item, it.Count)
|
resp = fmt.Sprintf("%s %s: %d", resp, it.Item, it.Count)
|
||||||
if count > 20 {
|
if count > 20 {
|
||||||
fmt.Sprintf("%s, and a few others", resp)
|
resp = fmt.Sprintf("%s, and a few others", resp)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,18 +229,18 @@ func NewFactoidPlugin(botInst *bot.Bot) *FactoidPlugin {
|
||||||
for _, channel := range botInst.Config.Channels {
|
for _, channel := range botInst.Config.Channels {
|
||||||
go p.factTimer(channel)
|
go p.factTimer(channel)
|
||||||
|
|
||||||
go func() {
|
go func(ch) {
|
||||||
// Some random time to start up
|
// Some random time to start up
|
||||||
time.Sleep(time.Duration(15) * time.Second)
|
time.Sleep(time.Duration(15) * time.Second)
|
||||||
if ok, fact := p.findTrigger(p.Bot.Config.StartupFact); ok {
|
if ok, fact := p.findTrigger(p.Bot.Config.StartupFact); ok {
|
||||||
p.sayFact(bot.Message{
|
p.sayFact(bot.Message{
|
||||||
Channel: channel,
|
Channel: ch,
|
||||||
Body: "speed test", // BUG: This is defined in the config too
|
Body: "speed test", // BUG: This is defined in the config too
|
||||||
Command: true,
|
Command: true,
|
||||||
Action: false,
|
Action: false,
|
||||||
}, *fact)
|
}, *fact)
|
||||||
}
|
}
|
||||||
}()
|
}(channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
return p
|
return p
|
||||||
|
@ -373,7 +373,7 @@ func (p *FactoidPlugin) tellThemWhatThatWas(message bot.Message) bool {
|
||||||
msg = "Nope."
|
msg = "Nope."
|
||||||
} else {
|
} else {
|
||||||
msg = fmt.Sprintf("That was (#%d) '%s <%s> %s'",
|
msg = fmt.Sprintf("That was (#%d) '%s <%s> %s'",
|
||||||
fact.id, fact.fact, fact.verb, fact.tidbit)
|
fact.id.Int64, fact.fact, fact.verb, fact.tidbit)
|
||||||
}
|
}
|
||||||
p.Bot.SendMessage(message.Channel, msg)
|
p.Bot.SendMessage(message.Channel, msg)
|
||||||
return true
|
return true
|
||||||
|
@ -435,7 +435,7 @@ func (p *FactoidPlugin) forgetLastFact(message bot.Message) bool {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Error removing fact: ", p.LastFact, err)
|
log.Println("Error removing fact: ", p.LastFact, err)
|
||||||
}
|
}
|
||||||
fmt.Printf("Forgot #%d: %s %s %s\n", p.LastFact.id, p.LastFact.fact,
|
fmt.Printf("Forgot #%d: %s %s %s\n", p.LastFact.id.Int64, p.LastFact.fact,
|
||||||
p.LastFact.verb, p.LastFact.tidbit)
|
p.LastFact.verb, p.LastFact.tidbit)
|
||||||
p.Bot.SendAction(message.Channel, "hits himself over the head with a skillet")
|
p.Bot.SendAction(message.Channel, "hits himself over the head with a skillet")
|
||||||
p.LastFact = nil
|
p.LastFact = nil
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Package to connect to slack service
|
// Package slack connects to slack service
|
||||||
package slack
|
package slack
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -113,7 +113,7 @@ func (s *Slack) Serve() {
|
||||||
for {
|
for {
|
||||||
msg, err := s.receiveMessage()
|
msg, err := s.receiveMessage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Slack API error: ", err)
|
log.Fatalf("Slack API error: %s", err)
|
||||||
}
|
}
|
||||||
switch msg.Type {
|
switch msg.Type {
|
||||||
case "message":
|
case "message":
|
||||||
|
@ -134,7 +134,7 @@ func (s *Slack) Serve() {
|
||||||
|
|
||||||
// Convert a slackMessage to a bot.Message
|
// Convert a slackMessage to a bot.Message
|
||||||
func (s *Slack) buildMessage(msg slackMessage) bot.Message {
|
func (s *Slack) buildMessage(msg slackMessage) bot.Message {
|
||||||
log.Println("DEBUG: msg: %%#v", msg)
|
log.Printf("DEBUG: msg: %#v", msg)
|
||||||
text := html.UnescapeString(msg.Text)
|
text := html.UnescapeString(msg.Text)
|
||||||
|
|
||||||
isCmd, text := bot.IsCmd(s.config, text)
|
isCmd, text := bot.IsCmd(s.config, text)
|
||||||
|
|
Loading…
Reference in New Issue