Documentation
¶
Index ¶
- Constants
- func ActionCacheAsJSON(actions []Action) (string, error)
- func BlockCacheAsJSON(blocks []slack.Block) (string, error)
- func CacheToBlock(cache *BlockCache) (slack.Block, error)
- func CacheToBlocks(caches []*BlockCache) ([]slack.Block, error)
- func CacheToTextBlockObject(cache *TextBlockCache) *slack.TextBlockObject
- func GetStringKeys(arr map[string]interface{}) []string
- func IfDef(cond bool, v1, v2 interface{}) interface{}
- func InterfaceListAsStrings(items []interface{}) []string
- func LoadTemplate(name, tmpl string) (*template.Template, error)
- func LoadYaml(config string, obj interface{}) (bool, error)
- func MakeTemplateJsonResult(err error) map[string]interface{}
- func MergeInterfaceMaps(maps ...map[string]interface{}) map[string]interface{}
- func RemoveEmptyStrings(items []string) []string
- func Render(def string, obj interface{}, observability *Observability) string
- func RenderTemplate(tpl *toolsRender.TextTemplate, def string, obj interface{}) (string, error)
- func Schedule(what func(), delay time.Duration) chan bool
- func TemplateShortError(err error) error
- func UUID() string
- type Action
- type ActionCache
- type ActionElementCache
- type Approval
- type Attachment
- type AttachmentType
- type BlockCache
- type Bot
- type Bots
- type Channel
- type Command
- type ExecuteParams
- type Executor
- type Field
- type FieldType
- type Message
- type Observability
- func (o *Observability) Debug(obj interface{}, args ...interface{})
- func (o *Observability) Error(obj interface{}, args ...interface{})
- func (o *Observability) Info(obj interface{}, args ...interface{})
- func (o *Observability) Logs() *sre.Logs
- func (o *Observability) Metrics() *sre.Metrics
- func (o *Observability) Panic(obj interface{}, args ...interface{})
- func (o *Observability) Warn(obj interface{}, args ...interface{})
- type Processor
- type Processors
- func (ps *Processors) Add(p Processor)
- func (ps *Processors) AddList(list []Processor)
- func (ps *Processors) Exists(processor string) bool
- func (ps *Processors) FindCommand(processor, command string) Command
- func (ps *Processors) FindCommandByAlias(alias string) (string, Command)
- func (ps *Processors) Items() []Processor
- type Response
- type SimpleAction
- type TextBlockCache
- type User
Constants ¶
const ( AttachmentTypeUnknown = "" AttachmentTypeText = "text" AttachmentTypeImage = "image" AttachmentTypeFile = "file" )
const ( FileTypeUnknown = "" FileTypeText = "text" FileTypeImage = "image" )
const ( FieldTypeUnknown = "" FieldTypeEdit = "edit" FieldTypeMultiEdit = "multiedit" FieldTypeInteger = "integer" FieldTypeFloat = "float" FieldTypeURL = "url" FieldTypeDate = "date" FieldTypeTime = "time" FieldTypeSelect = "select" FieldTypeMultiSelect = "multiselect" FieldTypeDynamicSelect = "dynamicselect" FieldTypeDynamicMultiSelect = "dynamicmultiselect" FieldTypeRadionButtons = "radiobuttons" FieldTypeCheckboxes = "checkboxes" FieldTypeBool = "bool" FieldTypeMarkdown = "markdown" FieldTypeUser = "user" FieldTypeMultiUser = "multiuser" FieldTypeChannel = "channel" FieldTypeMultiChannel = "multichannel" FieldTypeGroup = "group" FieldTypeMultiGroup = "multigroup" FieldTypeHidden = "hidden" )
Variables ¶
This section is empty.
Functions ¶
func ActionCacheAsJSON ¶ added in v0.12.1
ActionCacheAsJSON serializes a list of actions to a JSON string
func BlockCacheAsJSON ¶ added in v0.12.1
BlockCacheAsJSON serializes a list of blocks to a JSON string
func CacheToBlock ¶ added in v0.12.1
func CacheToBlock(cache *BlockCache) (slack.Block, error)
CacheToBlock converts a BlockCache back to a slack.Block
func CacheToBlocks ¶ added in v0.12.1
func CacheToBlocks(caches []*BlockCache) ([]slack.Block, error)
CacheToBlocks converts a slice of BlockCache back to a slice of slack.Block
func CacheToTextBlockObject ¶ added in v0.12.1
func CacheToTextBlockObject(cache *TextBlockCache) *slack.TextBlockObject
CacheToTextBlockObject converts a TextBlockCache back to a slack.TextBlockObject
func GetStringKeys ¶ added in v0.1.1
func InterfaceListAsStrings ¶ added in v0.10.9
func InterfaceListAsStrings(items []interface{}) []string
func MakeTemplateJsonResult ¶ added in v0.11.13
func MergeInterfaceMaps ¶ added in v0.3.4
func RemoveEmptyStrings ¶ added in v0.0.3
func Render ¶ added in v0.5.0
func Render(def string, obj interface{}, observability *Observability) string
func RenderTemplate ¶ added in v0.5.0
func RenderTemplate(tpl *toolsRender.TextTemplate, def string, obj interface{}) (string, error)
func TemplateShortError ¶ added in v0.11.13
template: tenplate-name:17:4: executing ... error calling ...
Types ¶
type Action ¶ added in v0.9.3
func ActionsFromCaches ¶ added in v0.12.1
func ActionsFromCaches(caches []*ActionCache) []Action
ActionsFromCaches converts a slice of ActionCache to a slice of Action interfaces
func NewSimpleActionFromCache ¶ added in v0.12.1
func NewSimpleActionFromCache(cache *ActionCache) Action
NewSimpleActionFromCache creates a new SimpleAction from an ActionCache
type ActionCache ¶ added in v0.12.1
type ActionCache struct {
// Basic properties from the Action interface
Name string `json:"name,omitempty"`
Label string `json:"label,omitempty"`
Template string `json:"template,omitempty"`
Style string `json:"style,omitempty"`
// Type information to help with deserialization
Type string `json:"type,omitempty"`
}
ActionCache is a serializable representation of the Action interface It allows for proper serialization and deserialization of Action objects
func ActionCacheFromJSON ¶ added in v0.12.1
func ActionCacheFromJSON(jsonStr string) ([]*ActionCache, error)
ActionCacheFromJSON deserializes a JSON string to a list of ActionCache objects
func ToActionCache ¶ added in v0.12.1
func ToActionCache(action Action) (*ActionCache, error)
ToActionCache converts an Action interface to a serializable ActionCache
func ToActionCacheList ¶ added in v0.12.1
func ToActionCacheList(actions []Action) ([]*ActionCache, error)
ToActionCacheList converts a slice of Action interfaces to a serializable slice of ActionCache
type ActionElementCache ¶ added in v0.12.1
type ActionElementCache struct {
Type string `json:"type"`
ActionID string `json:"action_id"`
Text *TextBlockCache `json:"text,omitempty"`
Value string `json:"value,omitempty"`
URL string `json:"url,omitempty"`
Style string `json:"style,omitempty"`
}
ActionElementCache represents button elements in a serializable form
type Attachment ¶
type Attachment struct {
Title string
Text string
Data []byte
Type AttachmentType
}
type AttachmentType ¶ added in v0.0.2
type AttachmentType string
type BlockCache ¶ added in v0.12.1
type BlockCache struct {
// Type of the block
Type string `json:"type"`
// Block ID if present
BlockID string `json:"block_id,omitempty"`
// Raw JSON data of the block for complete serialization
RawData json.RawMessage `json:"raw_data,omitempty"`
// For button blocks within action blocks
ActionElements []ActionElementCache `json:"action_elements,omitempty"`
// For text blocks
Text *TextBlockCache `json:"text,omitempty"`
// For image blocks
ImageURL string `json:"image_url,omitempty"`
AltText string `json:"alt_text,omitempty"`
// For file blocks
FileID string `json:"file_id,omitempty"`
ExternalID string `json:"external_id,omitempty"`
Source string `json:"source,omitempty"`
}
BlockCache is a serializable representation of a slack.Block It allows for proper serialization and deserialization of Block objects
func BlockCacheFromJSON ¶ added in v0.12.1
func BlockCacheFromJSON(jsonStr string) ([]*BlockCache, error)
BlockCacheFromJSON deserializes a JSON string to a list of BlockCache objects
func BlockToCache ¶ added in v0.12.1
func BlockToCache(block slack.Block) (*BlockCache, error)
BlockToCache converts a slack.Block to a BlockCache
func BlocksToCache ¶ added in v0.12.1
func BlocksToCache(blocks []slack.Block) ([]*BlockCache, error)
BlocksToCache converts a slice of slack.Block to a slice of BlockCache
type Bot ¶
type Bot interface {
Start(wg *sync.WaitGroup)
Stop()
Name() string
Command(channel, text string, user User, parent Message, response Response) error
AddReaction(channel, ID, name string) error
RemoveReaction(channel, ID, name string) error
AddAction(channel, ID string, action Action) error
AddActions(channel, ID string, actions []Action) error
RemoveAction(channel, ID, name string) error
ClearActions(channel, ID string) error
PostMessage(channel string, message string, attachments []*Attachment, actions []Action, user User, parent Message, response Response) (string, error)
DeleteMessage(channel, ID string) error
ReadMessage(channel, ID, threadID string) (string, error)
ReadThread(channel, threadID string) ([]string, error)
UpdateMessage(channel, ID, message string) error
TagMessage(channel, ID string, tags map[string]string) error
FindMessagesByTag(tagKey, tagValue string) map[string]string
SendImage(channelID, threadTS string, fileContent []byte, filename, initialComment string) error
AddDivider(channel, ID string) error
}
type Command ¶
type Command interface {
Name() string
Group() string
Description() string
Params() []string
Aliases() []string
Confirmation(params ExecuteParams) string
Priority() int
Wrapper() bool
Schedule() string
Channel() string
Response() Response
Actions() []Action
Approval() Approval
Permissions() bool
TrackMessages() bool
Execute(bot Bot, message Message, params ExecuteParams, action Action) (Executor, string, []*Attachment, []Action, error)
Fields(bot Bot, message Message, params ExecuteParams, eval []string, parent Field) []Field
}
type ExecuteParams ¶
type ExecuteParams = map[string]interface{}
type Observability ¶
type Observability struct {
// contains filtered or unexported fields
}
func NewObservability ¶
func NewObservability(logs *sre.Logs, metrics *sre.Metrics) *Observability
func (*Observability) Debug ¶
func (o *Observability) Debug(obj interface{}, args ...interface{})
func (*Observability) Error ¶
func (o *Observability) Error(obj interface{}, args ...interface{})
func (*Observability) Info ¶
func (o *Observability) Info(obj interface{}, args ...interface{})
func (*Observability) Logs ¶
func (o *Observability) Logs() *sre.Logs
func (*Observability) Metrics ¶
func (o *Observability) Metrics() *sre.Metrics
func (*Observability) Panic ¶ added in v0.7.4
func (o *Observability) Panic(obj interface{}, args ...interface{})
func (*Observability) Warn ¶
func (o *Observability) Warn(obj interface{}, args ...interface{})
type Processors ¶
type Processors struct {
// contains filtered or unexported fields
}
func NewProcessors ¶
func NewProcessors() *Processors
func (*Processors) Add ¶
func (ps *Processors) Add(p Processor)
func (*Processors) AddList ¶
func (ps *Processors) AddList(list []Processor)
func (*Processors) Exists ¶ added in v0.5.0
func (ps *Processors) Exists(processor string) bool
func (*Processors) FindCommand ¶ added in v0.5.0
func (ps *Processors) FindCommand(processor, command string) Command
func (*Processors) FindCommandByAlias ¶ added in v0.5.1
func (ps *Processors) FindCommandByAlias(alias string) (string, Command)
func (*Processors) Items ¶
func (ps *Processors) Items() []Processor
type SimpleAction ¶ added in v0.12.1
type SimpleAction struct {
// contains filtered or unexported fields
}
SimpleAction is a basic implementation of the Action interface that can be created from an ActionCache
func (*SimpleAction) Label ¶ added in v0.12.1
func (a *SimpleAction) Label() string
func (*SimpleAction) Name ¶ added in v0.12.1
func (a *SimpleAction) Name() string
func (*SimpleAction) Style ¶ added in v0.12.1
func (a *SimpleAction) Style() string
func (*SimpleAction) Template ¶ added in v0.12.1
func (a *SimpleAction) Template() string
type TextBlockCache ¶ added in v0.12.1
type TextBlockCache struct {
Type string `json:"type"`
Text string `json:"text"`
Emoji bool `json:"emoji,omitempty"`
Verbatim bool `json:"verbatim,omitempty"`
}
TextBlockCache represents slack.TextBlockObject in a serializable form
func TextBlockObjectToCache ¶ added in v0.12.1
func TextBlockObjectToCache(text *slack.TextBlockObject) *TextBlockCache
TextBlockObjectToCache converts a slack.TextBlockObject to a TextBlockCache