Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/glacials/split. a Slack chat bot that meows
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445package main
import ( "fmt" "log" "os" "strings")
func main() { if len(os.Args) != 2 { fmt.Fprintf(os.Stderr, "usage: splitbot slack-bot-token\n") os.Exit(1) }
ws, id := slackConnect(os.Args[1])
for { m, err := getMessage(ws) if err != nil { log.Fatal(err) }
if m.Type == "message" && strings.HasPrefix(m.Text, "<@"+id+">") { // if so try to parse if // looks good, get the quote and reply with the result go func(m Message) { postMessage(ws, Message{ Type: m.Type, Channel: m.Channel, Text: "meow", }) }(m)} if m.Type=="message" && m == "hello"{ go func(m Message) { postMessage(ws, Message{ Type: m.Type, Channel: m.Channel, Text: "hello", }) }(m)} }}