Documentation ¶
Overview ¶
Package slack provides all the Slack specific code for Igor
Package slack provides all the Slack specific code for Igor
Index ¶
Constants ¶
const ResponseBad = "danger"
ResponseBad returns the color code for negative responses
const ResponseGood = "good"
ResponseGood returns the color code for positive responses
const ResponseWarning = "warning"
ResponseWarning returns the color code for warning responses
Variables ¶
This section is empty.
Functions ¶
func EscapeString ¶
EscapeString escapes any values as demanded by Slack This means it HTML escapes '&', '<', and '>' It doesn't double escape. If a string is already escaped it won't do it again. Meaning, if you supply "&" it will return "&"
Types ¶
type Attachment ¶
type Attachment struct { Title string `json:"title,omitempty"` TitleLink string `json:"title_link,omitempty"` Text string `json:"text,omitempty"` PreText string `json:"pretext,omitempty"` Color string `json:"color,omitempty"` Markdown []string `json:"mrkdwn_in,omitempty"` Fallback string `json:"fallback,omitempty"` AuthorName string `json:"author_name,omitempty"` AuthorLink string `json:"author_link,omitempty"` AuthorIcon string `json:"author_icon,omitempty"` ImageURL string `json:"image_url,omitempty"` ThumbURL string `json:"thumb_url,omitempty"` Fields []Field `json:"fields,omitempty"` }
Attachment contains the fields for a slack attachment
func (*Attachment) AddField ¶
func (a *Attachment) AddField(f Field)
AddField adds a field to the attachment
func (*Attachment) EnableMarkdownFor ¶
func (a *Attachment) EnableMarkdownFor(value string)
EnableMarkdownFor enables Markdown for a part of the attachment
type Field ¶
type Field struct { Title string `json:"title"` Value string `json:"value"` Short bool `json:"short,omitempty"` }
Field contains the fields for a field within a slack attachment
type Request ¶
type Request struct { Token string TeamID string TeamDomain string ChannelID string ChannelName string UserID string UserName string Command string Text string ResponseURL string }
Request contains the information sent through the request from Slack
func LoadRequestFromQuery ¶
LoadRequestFromQuery translates the query string sent by Slack into a Request struct
func (*Request) UserInList ¶
UserInList checks if the request's user is in the provided list
type Response ¶
type Response struct { Text string `json:"text"` ResponseType string `json:"response_type,omitempty"` Attachments []Attachment `json:"attachments,omitempty"` UnfurlLinks bool `json:"unfurl_links,omitempty"` UnfurlMedia bool `json:"unfurl_media,omitempty"` Markdown bool `json:"mrkdwn,omitempty"` Username string `json:"username,omitempty"` IconEmoji string `json:"icon_emoji,omitempty"` }
Response contains the fields for returning a response message to Slack
func NothingFoundResponse ¶
NothingFoundResponse is a specific response for when no matching trigger is found
func SomethingWrongResponse ¶
SomethingWrongResponse is a specific response for when an error occurred
func ValidationErrorResponse ¶
func ValidationErrorResponse() Response
ValidationErrorResponse is a specific response for when validation failed
func (*Response) AddAttachment ¶
func (response *Response) AddAttachment(a Attachment)
AddAttachment adds an attachment to the response
func (*Response) Escape ¶
func (response *Response) Escape()
Escape escapes all values in the Response that need to be escaped