本文整理匯總了Golang中github.com/nlopes/slack.Slack.OpenIMChannel方法的典型用法代碼示例。如果您正苦於以下問題:Golang Slack.OpenIMChannel方法的具體用法?Golang Slack.OpenIMChannel怎麽用?Golang Slack.OpenIMChannel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/nlopes/slack.Slack
的用法示例。
在下文中一共展示了Slack.OpenIMChannel方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createFormForEverybody
func createFormForEverybody(formMessage *slack.MessageEvent, api *slack.Slack) {
users, err := api.GetUsers()
if err != nil {
fmt.Println("Channel err ", err)
}
for _, user := range users {
//create user form DONE
//send dm to fill out form DONE
formResp := createFormForUser(formMessage, user.Id)
if user.Name == "typebot" || user.Id == "U085QG8D7" {
continue
}
_, _, chanId, err := api.OpenIMChannel(user.Id)
if err != nil {
fmt.Println("IM err ", err)
}
fmt.Println("formResp ", formResp)
formDM := fmt.Sprintf("A form has been created, go fill it out! %v", formResp.Links[1].Href)
api.PostMessage(chanId, formDM, slack.PostMessageParameters{
AsUser: true,
})
}
}
示例2: dmPerson
func dmPerson(user *slack.User, message string, api *slack.Slack) {
if user.Name == "typebot" {
return
}
_, _, chanId, err := api.OpenIMChannel(user.Id)
if err != nil {
fmt.Println("IM err ", err)
}
api.PostMessage(chanId, message, slack.PostMessageParameters{
AsUser: true,
})
}
示例3: dmAll
func dmAll(message string, api *slack.Slack) {
users, err := api.GetUsers()
if err != nil {
fmt.Println("Channel err ", err)
}
for _, user := range users {
if user.Name == "typebot" {
continue
}
_, _, chanId, err := api.OpenIMChannel(user.Id)
if err != nil {
fmt.Println("IM err ", err)
}
api.PostMessage(chanId, message, slack.PostMessageParameters{
AsUser: true,
})
}
}