Esempio n. 1
0
func CreatePokerStories(w http.ResponseWriter, r *http.Request) {
	webSession, _ := store.Get(r, "session")
	err := r.ParseForm()
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	channel := r.PostFormValue("channel")
	channelId := r.PostFormValue("channel_id")
	stories := r.PostFormValue("stories")

	session, err := db.GetCurrentSession(channel)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	if session == nil {
		fmt.Fprintf(w, "No current session for channel %s", channel)
		return
	}

	lines := strings.Split(stories, "\n")
	for _, s := range lines {
		s = strings.Trim(s, "\r")
		session.StartPokerStory(s)
	}

	h := utils.NewSlackHandler("poker", ":game_die:")
	h.SendMsg(channelId,
		fmt.Sprintf("%d stories were added to be estimated", len(lines)))

	msg := fmt.Sprintf("Added %d stories to this session", len(lines))
	webSession.Values["message"] = msg
	webSession.Save(r, w)

	location := fmt.Sprintf("/poker?channel_id=%s&channel=%s", channelId, channel)
	http.Redirect(w, r, location, 301)
}
Esempio n. 2
0
func init() {
	handler := utils.NewSlackHandler("Pivotal", ":triangular_ruler:")
	s := &bot{handler: handler}
	robots.RegisterRobot("pvt", s)
}
Esempio n. 3
0
func init() {
	handler := utils.NewSlackHandler("Users", ":two_men_holding_hands:")
	s := &bot{handler: handler}
	robots.RegisterRobot("user", s)
}
Esempio n. 4
0
func init() {
	handler := utils.NewSlackHandler("Project", ":books:")
	s := &bot{handler: handler}
	robots.RegisterRobot("project", s)
	robots.RegisterRobot("pr", s)
}
Esempio n. 5
0
func init() {
	handler := utils.NewSlackHandler("Vacation", ":surfer:")
	s := &bot{handler: handler}
	robots.RegisterRobot("vacation", s)
}
Esempio n. 6
0
func init() {
	handler := utils.NewSlackHandler("Poker", ":game_die:")
	s := &bot{handler: handler}
	robots.RegisterRobot("poker", s)
	robots.RegisterRobot("pk", s)
}
Esempio n. 7
0
func init() {
	handler := utils.NewSlackHandler("Store", ":floppy_disk:")
	s := &bot{handler: handler}
	robots.RegisterRobot("store", s)
}
Esempio n. 8
0
func init() {
	handler := utils.NewSlackHandler("GitHub", "https://assets-cdn.github.com/images/modules/logos_page/Octocat.png")
	s := &bot{handler: handler}
	robots.RegisterRobot("github", s)
	robots.RegisterRobot("gh", s)
}