Browse Source

Add gnu command

master
Matthew Faltys 7 years ago
parent
commit
06face6f4e
  1. 8
      lorebot/lorebot.go

8
lorebot/lorebot.go

@ -153,6 +153,9 @@ func dynamicCommandHandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *
case "rek": case "rek":
s := strings.SplitN(string(ev.Text), " ", 2) s := strings.SplitN(string(ev.Text), " ", 2)
rekhandler(redisClient, rtm, ev, s[1]) rekhandler(redisClient, rtm, ev, s[1])
case "gnu":
s := strings.SplitN(string(ev.Text), " ", 2)
gnuhandler(redisClient, rtm, ev, s[1])
case "created": case "created":
rtm.SendMessage(rtm.NewOutgoingMessage("command not yet supported", ev.Channel)) rtm.SendMessage(rtm.NewOutgoingMessage("command not yet supported", ev.Channel))
case "owner": case "owner":
@ -232,6 +235,11 @@ func rekhandler(redisClient *redis.Client, rtm *slack.RTM, ev *slack.MessageEven
rtm.SendMessage(rtm.NewOutgoingMessage(rekFmt, ev.Channel)) 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) { func checkLore(searchTerm string, redisClient *redis.Client) (string, error) {
val, err := redisClient.Get(fmt.Sprintf("lore:%s:content", searchTerm)).Result() val, err := redisClient.Get(fmt.Sprintf("lore:%s:content", searchTerm)).Result()
if err != nil { if err != nil {

Loading…
Cancel
Save