|
|
@ -70,8 +70,11 @@ Loop: |
|
|
|
if ev.Text == "test" { |
|
|
|
if ev.Text == "test" { |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage("MY NAME IS ..JHEFFFFF", ev.Channel)) |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage("MY NAME IS ..JHEFFFFF", ev.Channel)) |
|
|
|
} |
|
|
|
} |
|
|
|
if strings.Contains(ev.Text, "lore") { |
|
|
|
if strings.Contains(ev.Text, ".lore") { |
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage("THA LORE", ev.Channel)) |
|
|
|
//rtm.SendMessage(rtm.NewOutgoingMessage("THA LORE", ev.Channel))
|
|
|
|
|
|
|
|
s := strings.SplitN(string(ev.Text), " ", 2) |
|
|
|
|
|
|
|
//command, content := s[0], s[1]
|
|
|
|
|
|
|
|
lorehandler(rtm, ev, s[1]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
case *slack.RTMError: |
|
|
|
case *slack.RTMError: |
|
|
@ -119,3 +122,9 @@ func initRedisConnection() (*redis.Client, error) { |
|
|
|
_, redisErr := redisClient.Ping().Result() |
|
|
|
_, redisErr := redisClient.Ping().Result() |
|
|
|
return redisClient, redisErr |
|
|
|
return redisClient, redisErr |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func lorehandler(rtm *slack.RTM, ev *slack.MessageEvent, rawMessage string) { |
|
|
|
|
|
|
|
loreTerm := strings.Replace(rawMessage, ".lore", "", -1) |
|
|
|
|
|
|
|
println("searching for:", loreTerm) |
|
|
|
|
|
|
|
rtm.SendMessage(rtm.NewOutgoingMessage(fmt.Sprintf("searching for '%s'\n", loreTerm), ev.Channel)) |
|
|
|
|
|
|
|
} |
|
|
|