Browse Source

Add russian roulette rng roll

develop
Matthew Faltys 7 years ago
parent
commit
ac99f6d0ba
  1. 22
      lorebot/lorebot.go

22
lorebot/lorebot.go

@ -211,6 +211,10 @@ func staticCommandHandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *r
depricatedrnghandler(rtm, ev, redisClient) depricatedrnghandler(rtm, ev, redisClient)
case "roll": case "roll":
rollhandler(rtm, ev) rollhandler(rtm, ev)
case "d20":
d20handler(rtm, ev)
case "rr":
rrhandler(rtm, ev)
case "dice": case "dice":
dicerollhandler(rtm, ev) dicerollhandler(rtm, ev)
case "listen": case "listen":
@ -309,6 +313,24 @@ func dicerollhandler(rtm *slack.RTM, ev *slack.MessageEvent) {
rtm.SendMessage(rtm.NewOutgoingMessage(rndStr, ev.Channel)) rtm.SendMessage(rtm.NewOutgoingMessage(rndStr, ev.Channel))
} }
func rrhandler(rtm *slack.RTM, ev *slack.MessageEvent) {
//fmt.Print(rand.Intn(100))
dice := []string{"*click*", "*BANG*", "*click*", "*click*", "*click*", "*click*"}
rand.Seed(time.Now().UnixNano())
rndStr := dice[rand.Intn(len(dice)-1)]
rtm.SendMessage(rtm.NewOutgoingMessage(rndStr, ev.Channel))
}
func d20handler(rtm *slack.RTM, ev *slack.MessageEvent) {
//fmt.Print(rand.Intn(100))
dice := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
rand.Seed(time.Now().UnixNano())
rndStr := fmt.Sprintf("%d", dice[rand.Intn(len(dice)-1)])
rtm.SendMessage(rtm.NewOutgoingMessage(rndStr, ev.Channel))
}
func depricatedrnghandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *redis.Client) { func depricatedrnghandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *redis.Client) {
// get random lore from list // get random lore from list
rngLore, err := redisClient.SRandMember("index:lore:added").Result() rngLore, err := redisClient.SRandMember("index:lore:added").Result()

Loading…
Cancel
Save