slack

package
v1.0.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeString

func EscapeString(s string) string

EscapeString escapes special characters. `&` => "&amp;" `<` => "&lt;" `>` => "&gt;"

func Post

func Post(url string, timeout time.Duration, sm *Message) error

Post post slack message

Types

type Attachment

type Attachment struct {
	AuthorIcon string   `json:"author_icon,omitempty"`
	AuthorLink string   `json:"author_link,omitempty"`
	AuthorName string   `json:"author_name,omitempty"`
	Fallback   string   `json:"fallback,omitempty"`
	Color      string   `json:"color,omitempty"`
	Pretext    string   `json:"pretext,omitempty"`
	Title      string   `json:"title,omitempty"`
	TitleLink  string   `json:"title_link,omitempty"`
	Text       string   `json:"text,omitempty"`
	ImageURL   string   `json:"image_url,omitempty"`
	ThumbURL   string   `json:"thumb_url,omitempty"`
	Footer     string   `json:"footer,omitempty"`
	FooterIcon string   `json:"footer_icon,omitempty"`
	Fields     []*Field `json:"fields,omitempty"`
}

Attachment slack attachment

func (*Attachment) AddField

func (sm *Attachment) AddField(sf *Field)

AddField add a field

type Error

type Error struct {
	Status     string
	StatusCode int
	RetryAfter int
}

Error slack api error

func (*Error) Error

func (e *Error) Error() string

Error return error string

type Field

type Field struct {
	Title string `json:"title,omitempty"`
	Value string `json:"value,omitempty"`
	Short string `json:"short,omitempty"`
}

Field slack field

type Message

type Message struct {
	IconEmoji   string        `json:"icon_emoji,omitempty"`
	Text        string        `json:"text,omitempty"`
	Attachments []*Attachment `json:"attachments,omitempty"`
	Markdown    bool          `json:"mrkdwn"`
}

Message slack message

func (*Message) AddAttachment

func (sm *Message) AddAttachment(sa *Attachment)

AddAttachment add a attachment

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL