|
|
@ -157,10 +157,10 @@ func dynamicCommandHandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient * |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage("command not yet supported", ev.Channel)) |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage("command not yet supported", ev.Channel)) |
|
|
|
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(rtm, ev, s[1], redisClient) |
|
|
|
case "gnu": |
|
|
|
case "gnu": |
|
|
|
s := strings.SplitN(string(ev.Text), " ", 2) |
|
|
|
s := strings.SplitN(string(ev.Text), " ", 2) |
|
|
|
gnuhandler(redisClient, rtm, ev, s[1]) |
|
|
|
gnuhandler(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": |
|
|
@ -238,13 +238,13 @@ func contenthandler(rtm *slack.RTM, ev *slack.MessageEvent, message, queryType s |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func rekhandler(redisClient *redis.Client, rtm *slack.RTM, ev *slack.MessageEvent, target string) { |
|
|
|
func rekhandler(rtm *slack.RTM, ev *slack.MessageEvent, target string, redisClient *redis.Client) { |
|
|
|
rektBit, _ := redisClient.SRandMember("index:rekt").Result() |
|
|
|
rektBit, _ := redisClient.SRandMember("index:rekt").Result() |
|
|
|
rekFmt := fmt.Sprintf("%s %s", target, rektBit) |
|
|
|
rekFmt := fmt.Sprintf("%s %s", target, rektBit) |
|
|
|
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) { |
|
|
|
func gnuhandler(rtm *slack.RTM, ev *slack.MessageEvent, target string) { |
|
|
|
gnuFmt := fmt.Sprintf("slaps the nonfree software out of %s's hands", target) |
|
|
|
gnuFmt := fmt.Sprintf("slaps the nonfree software out of %s's hands", target) |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage(gnuFmt, ev.Channel)) |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage(gnuFmt, ev.Channel)) |
|
|
|
} |
|
|
|
} |
|
|
|