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

@ -265,7 +265,6 @@ func TestBabblerBadMiddleOutSeed(t *testing.T) {
assert.Equal(t, mb.Messages[0], "seabass never said 'anything true'") assert.Equal(t, mb.Messages[0], "seabass never said 'anything true'")
} }
func TestBabblerBatch(t *testing.T) { func TestBabblerBatch(t *testing.T) {
mb := bot.NewMockBot() mb := bot.NewMockBot()
c := New(mb) c := New(mb)

View File

@ -3,8 +3,8 @@
package reaction package reaction
import ( import (
"time"
"math/rand" "math/rand"
"time"
"github.com/velour/catbase/bot" "github.com/velour/catbase/bot"
"github.com/velour/catbase/bot/msg" "github.com/velour/catbase/bot/msg"
@ -45,7 +45,7 @@ func (p *ReactionPlugin) Message(message msg.Message) bool {
numPositiveReactions := len(p.Config.Reaction.PositiveReactions) numPositiveReactions := len(p.Config.Reaction.PositiveReactions)
numNegativeReactions := len(p.Config.Reaction.NegativeReactions) numNegativeReactions := len(p.Config.Reaction.NegativeReactions)
maxIndex := numPositiveReactions + numNegativeReactions * negativeWeight maxIndex := numPositiveReactions + numNegativeReactions*negativeWeight
index := rand.Intn(maxIndex) 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") page := strings.Join(c.data[start:end], "\n")
if end - start == maxLines { if end-start == maxLines {
c.currentLine = end c.currentLine = end
} else { } else {
c.currentLine = maxLines-(end-start) c.currentLine = maxLines - (end - start)
page += "\n" page += "\n"
page += strings.Join(c.data[0:c.currentLine], "\n") page += strings.Join(c.data[0:c.currentLine], "\n")
} }