From 06face6f4ea4f4cdfe90e8ada66a23f08a1e868b Mon Sep 17 00:00:00 2001 From: Matthew Faltys Date: Wed, 6 Sep 2017 20:30:50 -0500 Subject: [PATCH] Add gnu command --- lorebot/lorebot.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lorebot/lorebot.go b/lorebot/lorebot.go index c2fc109..e265268 100644 --- a/lorebot/lorebot.go +++ b/lorebot/lorebot.go @@ -153,6 +153,9 @@ func dynamicCommandHandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient * case "rek": s := strings.SplitN(string(ev.Text), " ", 2) rekhandler(redisClient, rtm, ev, s[1]) + case "gnu": + s := strings.SplitN(string(ev.Text), " ", 2) + gnuhandler(redisClient, rtm, ev, s[1]) case "created": rtm.SendMessage(rtm.NewOutgoingMessage("command not yet supported", ev.Channel)) case "owner": @@ -232,6 +235,11 @@ func rekhandler(redisClient *redis.Client, rtm *slack.RTM, ev *slack.MessageEven rtm.SendMessage(rtm.NewOutgoingMessage(rekFmt, ev.Channel)) } +func gnuhandler(redisClient *redis.Client, rtm *slack.RTM, ev *slack.MessageEvent, target string) { + gnuFmt := fmt.Sprintf("slaps the nonfree software out of %s's hands", target) + rtm.SendMessage(rtm.NewOutgoingMessage(gnuFmt, ev.Channel)) +} + func checkLore(searchTerm string, redisClient *redis.Client) (string, error) { val, err := redisClient.Get(fmt.Sprintf("lore:%s:content", searchTerm)).Result() if err != nil {