From 3f529521c4046b84ed450924c39048f418078d16 Mon Sep 17 00:00:00 2001 From: Matthew Faltys Date: Thu, 21 Dec 2017 13:46:13 -0600 Subject: [PATCH] Add RIP command --- lorebot/lorebot.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lorebot/lorebot.go b/lorebot/lorebot.go index 1b12640..9b82578 100644 --- a/lorebot/lorebot.go +++ b/lorebot/lorebot.go @@ -174,6 +174,9 @@ func dynamicCommandHandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient * case "rek": s := strings.SplitN(string(ev.Text), " ", 2) rekhandler(rtm, ev, s[1], redisClient) + case "rip": + s := strings.SplitN(string(ev.Text), " ", 2) + riphandler(rtm, ev, s[1]) case "gnu": s := strings.SplitN(string(ev.Text), " ", 2) gnuhandler(rtm, ev, s[1]) @@ -268,6 +271,14 @@ func rekhandler(rtm *slack.RTM, ev *slack.MessageEvent, target string, redisClie rtm.SendMessage(rtm.NewOutgoingMessage(rekFmt, ev.Channel)) } +func riphandler(rtm *slack.RTM, ev *slack.MessageEvent, target string) { + // create a timestamp to use + t := time.Now() + tstamp := t.Format("01-02-2006") + ripFmt := fmt.Sprintf("here lies %s, disrespected to death %s..", target, tstamp) + rtm.SendMessage(rtm.NewOutgoingMessage(ripFmt, ev.Channel)) +} + func rnghandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *redis.Client) { // get random lore from list rngLore, err := redisClient.SRandMember("index:lore:added").Result()