Esempio n. 1
0
func (s *slacker) Notify(eva EventAction, edata EventData) error {
	if !s.satisfied(eva) {
		return nil
	}
	if err := slack.NewClient(s.token).SendMessage("#"+s.chnl, edata.M["message"], "megamio"); err != nil {
		return err
	}
	return nil
}
Esempio n. 2
0
func main() {
	slackC = slack.NewClient(config.SlackToken)

	port := ":4000"
	if os.Getenv("ENV") == "production" {
		port = ":80"
	}

	server := web.NewServer(port, []web.Handler{
		new(web.SlashHandler),
		new(web.CorsHandler),
		&web.StatHandler{Key: config.StatHatKey, Name: "broome"},
	}, Routes)
	server.AuthHandler = &web.AuthHandler{Auth: AuthHandler}
	server.ListenAndServe()
}