Documentation ¶
Index ¶
- Variables
- func ParsePluginCommand(text string, user *slack.User) (message string, attachments []slack.Attachment)
- func SavePlugins(config Plugins) bool
- func TwilioConfigure(n string) (attachment slack.Attachment)
- func TwilioSet(n string) (attachment slack.Attachment)
- func TwilioUnset() (attachment slack.Attachment)
- type PagerDuty
- type Plugins
- func (p *Plugins) DemoPagerDuty()
- func (p *Plugins) DisablePagerDuty() (attachment slack.Attachment)
- func (p *Plugins) DisableTwilio() (attachment slack.Attachment)
- func (p *Plugins) EnablePagerDuty() (attachment slack.Attachment)
- func (p *Plugins) EnableTwilio() (attachment slack.Attachment)
- func (p *Plugins) PagerDutyStatus() (attachment slack.Attachment)
- func (p *Plugins) SendDispatcher(message string)
- func (p *Plugins) SendPagerDuty(message string)
- func (p *Plugins) SendTwilio(message string)
- func (p *Plugins) TwilioStatus() (attachment slack.Attachment)
- type Twilio
Constants ¶
This section is empty.
Variables ¶
var ( // TwilioPhone is the "to" phone number that's set through Slack (@slab twilio // set) TwilioPhone string // TwilioFrom is the "from" phone number that's set through Slack (@slab twilio // configure) TwilioFrom string // TwilioEnabled holds whether the Twilio plugin is enabled or disabled. TwilioEnabled bool )
var Commands map[string]func([]string) ([]slack.Attachment, string)
Commands is a map of all of the text commands needed to trigger individual plugins
var ( // PagerDutyEnabled holds whether the PagerDuty plugin is enabled or disabled. PagerDutyEnabled bool )
var Send map[string]func(*Plugins, string)
Send is a map of every function used to send plugin messages
Functions ¶
func ParsePluginCommand ¶
func ParsePluginCommand(text string, user *slack.User) (message string, attachments []slack.Attachment)
ParsePluginCommand is ran before the core Slab commands are parsed to determine if a given command is related to a plugin or not. If it is, it returns a message and attachment which is then sent in slack/commands.go
func SavePlugins ¶
SavePlugins takes a config and saves it to the local file, config.toml.
func TwilioConfigure ¶
func TwilioConfigure(n string) (attachment slack.Attachment)
TwilioConfigure sets the "from" phone number to allow for international numbers to be set properly
func TwilioSet ¶
func TwilioSet(n string) (attachment slack.Attachment)
TwilioSet changes the TwilioPhone to the value of the number passed to it.
func TwilioUnset ¶
func TwilioUnset() (attachment slack.Attachment)
TwilioUnset sets the TwilioPhone to `none`
Types ¶
type Plugins ¶
Plugins contains a list of all available plugins
func LoadPlugins ¶
func LoadPlugins() (config Plugins)
LoadPlugins grabs the command line argument for where the configuration file is located and loads that into memory.
func (*Plugins) DemoPagerDuty ¶
func (p *Plugins) DemoPagerDuty()
DemoPagerDuty grabs a demo list of incidents from PagerDuty
func (*Plugins) DisablePagerDuty ¶
func (p *Plugins) DisablePagerDuty() (attachment slack.Attachment)
DisablePagerDuty changes the Enabled PagerDuty option to false.
func (*Plugins) DisableTwilio ¶
func (p *Plugins) DisableTwilio() (attachment slack.Attachment)
DisableTwilio changes the Enabled Twilio option to false.
func (*Plugins) EnablePagerDuty ¶
func (p *Plugins) EnablePagerDuty() (attachment slack.Attachment)
EnablePagerDuty changes the Enabled PagerDuty option to true.
func (*Plugins) EnableTwilio ¶
func (p *Plugins) EnableTwilio() (attachment slack.Attachment)
EnableTwilio changes the Enabled Twilio option to true.
func (*Plugins) PagerDutyStatus ¶
func (p *Plugins) PagerDutyStatus() (attachment slack.Attachment)
PagerDutyStatus returns the current setting
func (*Plugins) SendDispatcher ¶
SendDispatcher receives the message from the process loop and checks which plugins are enabled and sends the appropriate notifications through them.
func (*Plugins) SendPagerDuty ¶
SendPagerDuty sends a message to PagerDuty and returns a list of incidents
func (*Plugins) SendTwilio ¶
SendTwilio sends a message to the phone number currently set as TwilioPhone using the connection data found in the config
func (*Plugins) TwilioStatus ¶
func (p *Plugins) TwilioStatus() (attachment slack.Attachment)
TwilioStatus returns the current setting