slack

package
v0.0.0-...-b5d3c5c Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Notification = 1
	DM           = 2
	Mention      = 3

	// Message Type, Meal Type
	Morning = "morning"
	Lunch   = "lunch"
	Dinner  = "dinner"
)

Message Type, Meal Type

Variables

This section is empty.

Functions

func GetWeekday

func GetWeekday() string

GetWeekday is return weekday string. Example : 월요일

func Title

func Title(meal string) string

Title is create slack message title with date. Example: *01월 02일 수요일 점심*

Types

type Block

type Block struct {
	// section, divider
	Type      string      `json:"type"`
	Text      *TextBlock  `json:"text,omitempty"`
	Accessory *ImageBlock `json:"accessory,omitempty"`

	BlockID *string `json:"block_id,omitempty"` // response only
}

type BlockMsg

type BlockMsg struct {
	Channel   string   `json:"channel"`
	As_user   bool     `json:"as_user"`
	Text      string   `json:"text"`
	UserName  string   `json:"username"`
	IconEmoji string   `json:"icon_emoji"`
	Blocks    *[]Block `json:"blocks,omitempty"`
}

func (*BlockMsg) AddBlock

func (b *BlockMsg) AddBlock(blocks ...Block)

func (*BlockMsg) AddDividerBlock

func (b *BlockMsg) AddDividerBlock()

func (*BlockMsg) AddImageBlock

func (b *BlockMsg) AddImageBlock(text string, imageURL string)

func (*BlockMsg) AddMenuBlock

func (b *BlockMsg) AddMenuBlock(menu []response.Menu, title string, image bool, takeout bool)

func (*BlockMsg) AddPollBlock

func (b *BlockMsg) AddPollBlock()

func (*BlockMsg) AddTextBlock

func (b *BlockMsg) AddTextBlock(text string)

func (*BlockMsg) Init

func (b *BlockMsg) Init(text string)

type ImageBlock

type ImageBlock struct {
	Type     string `json:"type"`
	ImageURL string `json:"image_url"`
	AltText  string `json:"alt_text"`

	// response only
	Fallback    *string `json:"fallback,omitempty"`
	ImageWidth  *uint   `json:"image_width,omitempty"`
	ImageHeight *uint   `json:"image_height,omitempty"`
	ImageBytes  *uint   `json:"image_bytes,omitempty"`
}

type Slack

type Slack struct {
	// contains filtered or unexported fields
}

Slack have info of bots. like token, ...

func (*Slack) Connect

func (s *Slack) Connect(token string, channel string)

Connect is connect to slack bot api.

func (*Slack) DailyInit

func (s *Slack) DailyInit() error

DailyInit is intialize slack daily.

func (*Slack) MsgMonitor

func (s *Slack) MsgMonitor()

MsgMonitor is monitoring dm or mention

func (*Slack) SendMembersMsg

func (s *Slack) SendMembersMsg() error

SendMembersMsg is send number of meal members.

func (*Slack) SendMenu

func (s *Slack) SendMenu(channelID *string, meal_type string, msgtype int, image bool, takeout bool) error

SendMenu is send menu message to slack channel.

func (*Slack) SlackId

func (s *Slack) SlackId() string

type SlackResponse

type SlackResponse struct {
	Ok        bool   `json:"ok,omitempty"`
	Channel   string `json:"channel,omitempty"`
	Timestamp string `json:"ts,omitempty"`
	Message   struct {
		Bot_id    string  `json:"bot_id,omitempty"`
		Type      string  `json:"type,omitempty"`
		Text      string  `json:"text,omitempty"`
		User      string  `json:"user,omitempty"`
		Timestamp string  `json:"ts,omitempty"`
		Team      string  `json:"team,omitempty"`
		Blocks    []Block `json:"blocks,omitempty"`
	} `json:"message,omitempty"`
	Error             *string `json:"error,omitempty"`
	Warning           *string `json:"warning,omitempty"`
	Response_metadata *struct {
		Warnings []string `json:"warnings,omitempty"`
	} `json:"response_metadata,omitempty"`
}

type TextBlock

type TextBlock struct {
	Type string `json:"type"`
	Text string `json:"text"`

	Verbatim *bool `json:"verbatim,omitempty"` // response only
}

Jump to

Keyboard shortcuts

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