Ejemplo n.º 1
0
Archivo: qtest.go Proyecto: src-d/lazlo
func newQuestion(b *lazlo.Broker, req lazlo.PatternMatch) {
	lazlo.Logger.Info("new question")
	qcb := b.QuestionCallback(req.Event.User, req.Match[2])
	answer := <-qcb.Answer
	response := fmt.Sprintf("You answered: '%s'", answer)
	b.Say(response, qcb.DMChan)
}
Ejemplo n.º 2
0
Archivo: qtest.go Proyecto: src-d/lazlo
func runTest(b *lazlo.Broker, req lazlo.PatternMatch) {
	dmChan := b.GetDM(req.Event.User)
	user := b.SlackMeta.GetUserName(req.Event.User)
	b.Say(fmt.Sprintf(`hi %s! I'm going to ask you a few questions.`, user), dmChan)
	qcb := b.QuestionCallback(req.Event.User, `what is your name?`)
	name := <-qcb.Answer
	qcb = b.QuestionCallback(req.Event.User, `what is your quest?`)
	quest := <-qcb.Answer
	qcb = b.QuestionCallback(req.Event.User, `what is your favorite color?`)
	color := <-qcb.Answer
	b.Say(fmt.Sprintf(`awesome. you said your name is %s, your quest is %s and your favorite color is %s`, name, quest, color), dmChan)
}