diff --git a/bot/handlers.go b/bot/handlers.go index 651e0ae..16eccd8 100644 --- a/bot/handlers.go +++ b/bot/handlers.go @@ -77,7 +77,7 @@ func (b *bot) ReplyToMessageIdentifier(channel, message, identifier string) (str } func (b *bot) ReplyToMessage(channel, message string, replyTo msg.Message) (string, bool) { - return b.conn.ReplyToMessage(channel, message, replyTo) + return b.conn.ReplyToMessage(channel, message, replyTo) } func (b *bot) React(channel, reaction string, message msg.Message) bool { diff --git a/bot/msg/message.go b/bot/msg/message.go index 88e61f6..78a40f0 100644 --- a/bot/msg/message.go +++ b/bot/msg/message.go @@ -12,12 +12,12 @@ type Log Messages type Messages []Message type Message struct { - User *user.User - Channel, Body string - Raw string - Command bool - Action bool - Time time.Time - Host string + User *user.User + Channel, Body string + Raw string + Command bool + Action bool + Time time.Time + Host string AdditionalData map[string]string } diff --git a/config/config.go b/config/config.go index 0d345c7..8868b2b 100644 --- a/config/config.go +++ b/config/config.go @@ -90,7 +90,7 @@ type Config struct { Sightings []string } Emojify struct { - Chance float64 + Chance float64 Scoreless []string } Reaction struct { diff --git a/irc/irc.go b/irc/irc.go index 4c34529..b965749 100644 --- a/irc/irc.go +++ b/irc/irc.go @@ -42,9 +42,9 @@ type Irc struct { config *config.Config quit chan bool - eventReceived func(msg.Message) - messageReceived func(msg.Message) - replyMessageReceived func(msg.Message, string) + eventReceived func(msg.Message) + messageReceived func(msg.Message) + replyMessageReceived func(msg.Message, string) } func New(c *config.Config) *Irc { diff --git a/plugins/babbler/babbler_test.go b/plugins/babbler/babbler_test.go index b574f6a..5031a19 100644 --- a/plugins/babbler/babbler_test.go +++ b/plugins/babbler/babbler_test.go @@ -265,7 +265,6 @@ func TestBabblerBadMiddleOutSeed(t *testing.T) { assert.Equal(t, mb.Messages[0], "seabass never said 'anything true'") } - func TestBabblerBatch(t *testing.T) { mb := bot.NewMockBot() c := New(mb) diff --git a/plugins/reaction/reaction.go b/plugins/reaction/reaction.go index 7b204b4..aacdbb0 100644 --- a/plugins/reaction/reaction.go +++ b/plugins/reaction/reaction.go @@ -3,8 +3,8 @@ package reaction import ( - "time" "math/rand" + "time" "github.com/velour/catbase/bot" "github.com/velour/catbase/bot/msg" @@ -12,7 +12,7 @@ import ( ) type ReactionPlugin struct { - Bot bot.Bot + Bot bot.Bot Config *config.Config } @@ -20,7 +20,7 @@ func New(bot bot.Bot) *ReactionPlugin { rand.Seed(time.Now().Unix()) return &ReactionPlugin{ - Bot: bot, + Bot: bot, Config: bot.Config(), } } @@ -45,7 +45,7 @@ func (p *ReactionPlugin) Message(message msg.Message) bool { numPositiveReactions := len(p.Config.Reaction.PositiveReactions) numNegativeReactions := len(p.Config.Reaction.NegativeReactions) - maxIndex := numPositiveReactions + numNegativeReactions * negativeWeight + maxIndex := numPositiveReactions + numNegativeReactions*negativeWeight index := rand.Intn(maxIndex) diff --git a/plugins/rss/rss.go b/plugins/rss/rss.go index 099cdf9..37a5b1d 100644 --- a/plugins/rss/rss.go +++ b/plugins/rss/rss.go @@ -38,10 +38,10 @@ func (c *cacheItem) getCurrentPage(maxLines int) string { page := strings.Join(c.data[start:end], "\n") - if end - start == maxLines { + if end-start == maxLines { c.currentLine = end } else { - c.currentLine = maxLines-(end-start) + c.currentLine = maxLines - (end - start) page += "\n" page += strings.Join(c.data[0:c.currentLine], "\n") } diff --git a/plugins/your/your.go b/plugins/your/your.go index 9e24082..c8805b2 100644 --- a/plugins/your/your.go +++ b/plugins/your/your.go @@ -13,7 +13,7 @@ import ( ) type YourPlugin struct { - bot bot.Bot + bot bot.Bot config *config.Config } @@ -21,7 +21,7 @@ type YourPlugin struct { func New(bot bot.Bot) *YourPlugin { rand.Seed(time.Now().Unix()) return &YourPlugin{ - bot: bot, + bot: bot, config: bot.Config(), } } diff --git a/slack/slack.go b/slack/slack.go index 3c81389..d4cedb1 100644 --- a/slack/slack.go +++ b/slack/slack.go @@ -230,8 +230,8 @@ func (s *Slack) SendMessageType(channel, message string, meMessage bool) (string type MessageResponse struct { OK bool `json:"ok"` Timestamp string `json:"ts"` - Message struct { - BotID string `json:"bot_id"` + Message struct { + BotID string `json:"bot_id"` } `json:"message"` }