Merge pull request #147 from velour/teature

A new small tea-ture
This commit is contained in:
Scott Kiesel 2019-02-12 11:07:20 -05:00 committed by GitHub
commit d569810db6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import (
"database/sql" "database/sql"
"fmt" "fmt"
"log" "log"
"math/rand"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
@ -474,7 +475,16 @@ func (p *CounterPlugin) checkMatch(message msg.Message) bool {
} }
log.Printf("About to update item: %#v", item) log.Printf("About to update item: %#v", item)
item.UpdateDelta(1) item.UpdateDelta(1)
p.Bot.Send(bot.Message, channel, fmt.Sprintf("bleep-bloop-blop... %s has %d %s", p.Bot.Send(bot.Message, channel, fmt.Sprintf("%s... %s has %d %s",
nick, item.Count, itemName)) strings.Join(everyDayImShuffling([]string{"bleep", "bloop", "blop"}), "-"), nick, item.Count, itemName))
return true return true
} }
func everyDayImShuffling(vals []string) []string {
ret := make([]string, len(vals))
perm := rand.Perm(len(vals))
for i, randIndex := range perm {
ret[i] = vals[randIndex]
}
return ret
}