當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Attachment.Title方法代碼示例

本文整理匯總了Golang中github.com/nlopes/slack.Attachment.Title方法的典型用法代碼示例。如果您正苦於以下問題:Golang Attachment.Title方法的具體用法?Golang Attachment.Title怎麽用?Golang Attachment.Title使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/nlopes/slack.Attachment的用法示例。


在下文中一共展示了Attachment.Title方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: statusToSlack

func statusToSlack(api *slack.Client, my_name string, channel string, msg string) {
	params := slack.NewPostMessageParameters()
	params.Username = my_name
	params.IconEmoji = ":exclamation:"
	attachment := slack.Attachment{}
	attachment.Color = "#ffaa00"
	attachment.Title = "Alarm Status Update"
	attachment.Text = msg
	params.Attachments = []slack.Attachment{attachment}
	api.PostMessage(channel, "", params)
}
開發者ID:ballarat-hackerspace,項目名稱:alarmbot-go,代碼行數:11,代碼來源:alarmbot.go

示例2: logToSlack

func logToSlack(api *slack.Client, my_name string, channel string, msg string, fields []slack.AttachmentField) {
	params := slack.NewPostMessageParameters()
	params.Username = my_name
	params.IconEmoji = ":page_with_curl:"
	attachment := slack.Attachment{}
	attachment.Color = "#ffaa00"
	attachment.Title = "Log Entry"
	attachment.Text = msg
	attachment.Fields = fields
	params.Attachments = []slack.Attachment{attachment}
	api.PostMessage(channel, "", params)
}
開發者ID:ballarat-hackerspace,項目名稱:alarmbot-go,代碼行數:12,代碼來源:alarmbot.go

示例3: motionToSlack

func motionToSlack(api *slack.Client, my_name string, channel string, image string, count int) {
	_, err := http.Get(image)
	chk(err)

	params := slack.NewPostMessageParameters()
	params.Username = my_name
	params.IconEmoji = ":rotating_light:"
	attachment := slack.Attachment{}
	attachment.Color = "#ff0000"
	attachment.Title = "Motion detected"
	attachment.Text = fmt.Sprintf("Motion events detected: %d", count)
	attachment.ImageURL = image
	params.Attachments = []slack.Attachment{attachment}
	api.PostMessage(channel, "", params)
}
開發者ID:ballarat-hackerspace,項目名稱:alarmbot-go,代碼行數:15,代碼來源:alarmbot.go

示例4: lightsToSlack

func lightsToSlack(api *slack.Client, my_name string, channel string, image string, level int) {
	_, err := http.Get(image)
	chk(err)

	params := slack.NewPostMessageParameters()
	params.Username = my_name
	params.IconEmoji = ":bulb:"
	attachment := slack.Attachment{}
	attachment.Color = "#00ff00"
	attachment.Title = "Lights detected"
	attachment.Text = fmt.Sprintf("Light level detected: %d", level)
	attachment.ImageURL = image
	params.Attachments = []slack.Attachment{attachment}
	api.PostMessage(channel, "", params)
}
開發者ID:ballarat-hackerspace,項目名稱:alarmbot-go,代碼行數:15,代碼來源:alarmbot.go


注:本文中的github.com/nlopes/slack.Attachment.Title方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。