|
|
@ -6,6 +6,7 @@ import ( |
|
|
|
"io" |
|
|
|
"io" |
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
|
"log" |
|
|
|
"log" |
|
|
|
|
|
|
|
"math/rand" |
|
|
|
"mime/multipart" |
|
|
|
"mime/multipart" |
|
|
|
"net/http" |
|
|
|
"net/http" |
|
|
|
"net/textproto" |
|
|
|
"net/textproto" |
|
|
@ -206,6 +207,8 @@ func staticCommandHandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *r |
|
|
|
advancedhelpmsg(rtm, ev) |
|
|
|
advancedhelpmsg(rtm, ev) |
|
|
|
case "rng": |
|
|
|
case "rng": |
|
|
|
rnghandler(rtm, ev, redisClient) |
|
|
|
rnghandler(rtm, ev, redisClient) |
|
|
|
|
|
|
|
case "betarng": |
|
|
|
|
|
|
|
betarnghandler(rtm, ev, redisClient) |
|
|
|
case "listen": |
|
|
|
case "listen": |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage("*it's what you hearin*", ev.Channel)) |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage("*it's what you hearin*", ev.Channel)) |
|
|
|
case "lorelist": |
|
|
|
case "lorelist": |
|
|
@ -305,6 +308,29 @@ func rnghandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *redis.Clien |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage(rngMsg, ev.Channel)) |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage(rngMsg, ev.Channel)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func betarnghandler(rtm *slack.RTM, ev *slack.MessageEvent, redisClient *redis.Client) { |
|
|
|
|
|
|
|
// aka index:command:added
|
|
|
|
|
|
|
|
newType := fmt.Sprintf("index:lore:added") |
|
|
|
|
|
|
|
//command, err := botfunc.Query(newType, redisClient)
|
|
|
|
|
|
|
|
command, err := loreQuery(newType, redisClient) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
glogger.Error.Println(err) |
|
|
|
|
|
|
|
println(err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
rngLore := fmt.Sprint(command[rand.Intn(len(command))]) |
|
|
|
|
|
|
|
println(rngLore) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// get lore content
|
|
|
|
|
|
|
|
rngContent, err := loreCheck(rngLore, "lore", redisClient) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
fmt.Printf("%v\n", err) |
|
|
|
|
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage("beep boop.. broken bot..", ev.Channel)) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
rngMsg := fmt.Sprintf("Random lore: `%s`\n%s", rngLore, rngContent) |
|
|
|
|
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage(rngMsg, ev.Channel)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func gnuhandler(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)) |
|
|
|