This commit is contained in:
Chris Sexton 2018-05-02 07:02:04 -04:00
parent f164530359
commit c639d460ac
9 changed files with 22 additions and 23 deletions

View File

@ -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 {

View File

@ -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
}

View File

@ -90,7 +90,7 @@ type Config struct {
Sightings []string
}
Emojify struct {
Chance float64
Chance float64
Scoreless []string
}
Reaction struct {

View File

@ -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 {

View File

@ -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)

View File

@ -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)

View File

@ -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")
}

View File

@ -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(),
}
}

View File

@ -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"`
}