bot

package
v0.0.0-...-ad54c1f Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetChatMsg

func GetChatMsg(atts map[string]string) *chat.Message

GetChatMsg returns a struct representing a Message formatted with Google Chat "Cards" with information about a Release or Rollout depending on the ResourceType key in atts.

Types

type Block

type Block struct {
	TypeSectionBlock string        `json:"type,omitempty"`
	Text             *TextBlock    `json:"text,omitempty"`
	Fields           []TextBlock   `json:"fields,omitempty"`
	Elements         []ButtonBlock `json:"elements,omitempty"`
}

func GetSlackMsg

func GetSlackMsg(atts map[string]string) []Block

func GetSlackMsgRelease

func GetSlackMsgRelease(atts map[string]string) []Block

GetSlackMsgRelease returns a struct representing a "Block Kit" formatted Slack message with information about a Release

func GetSlackMsgRollout

func GetSlackMsgRollout(atts map[string]string) []Block

GetSlackMsgRelease returns a struct representing a "Block Kit" formatted Slack message with information about a Rollout

type Bot

type Bot interface {
	SendMessage(channel string, message map[string]string) (string, error)
}

Bot should format the message the way it sees fit using the message map to identify the type of message and to organise key info into the best layout for the different chat systems.

type ButtonBlock

type ButtonBlock struct {
	TypeButtonBlock string     `json:"type,omitempty"`
	Text            ButtonText `json:"text,omitempty"`
	Style           string     `json:"style,omitempty"`
	Value           string     `json:"value,omitempty"`
}

type ButtonText

type ButtonText struct {
	TypeButton string `json:"type,omitempty"`
	Emoji      bool   `json:"emoji,omitempty"`
	Text       string `json:"text,omitempty"`
}

type GChatAdapter

type GChatAdapter struct {
	BotToken    string
	URLEndpoint string
}

func (*GChatAdapter) SendMessage

func (chatter *GChatAdapter) SendMessage(channel string, message map[string]string) (string, error)

type SlackAdapter

type SlackAdapter struct {
	BotToken    string
	URLEndpoint string
}

func (*SlackAdapter) SendMessage

func (slacker *SlackAdapter) SendMessage(channel string, message map[string]string) (string, error)

type SlackMessageWrapper

type SlackMessageWrapper struct {
	Token   string  `json:"token,omitempty"`
	Channel string  `json:"channel,omitempty"`
	Unfurl  bool    `json:"unfurl_links,omitempty"`
	Text    string  `json:"text,omitempty"`
	Blocks  []Block `json:"blocks,omitempty"`
}

type TextBlock

type TextBlock struct {
	TypeTextBlock string `json:"type,omitempty"`
	Text          string `json:"text,omitempty"`
	Emoji         bool   `json:"emoji,omitempty"`
}

Jump to

Keyboard shortcuts

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