本文整理汇总了Golang中github.com/djosephsen/hustlebot/lib.Broker.GetDM方法的典型用法代码示例。如果您正苦于以下问题:Golang Broker.GetDM方法的具体用法?Golang Broker.GetDM怎么用?Golang Broker.GetDM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/djosephsen/hustlebot/lib.Broker
的用法示例。
在下文中一共展示了Broker.GetDM方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getHelp
func getHelp(b *lazlo.Broker, pm *lazlo.PatternMatch) {
dmChan := b.GetDM(pm.Event.User)
reply := `########## Modules In use: `
for _, m := range b.Modules {
if strings.Contains(m.Usage, `%HIDDEN%`) {
continue
}
usage := strings.Replace(m.Usage, `%BOTNAME%`, b.Config.Name, -1)
reply = fmt.Sprintf("%s\n%s", reply, usage)
}
b.Say(reply, dmChan)
}
示例2: runTest
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)
}