monitor

package
v0.0.0-...-3835bca Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SlackConfig

type SlackConfig struct {
	// APIKey is Slack API key
	APIKey string
	// Channel is the name of Slack channel
	Channel string
	// User is the name of Slack user
	User string
	// Msg is the message we are matching for
	Msg string
}

SlackConfig configures Slack API client

type SlackMonitor

type SlackMonitor struct {
	// embedding Slack client
	*slack.Client

	// mutex
	*sync.Mutex
	// contains filtered or unexported fields
}

SlackMonitor is Slack API client which monitors messages

func NewSlackMonitor

func NewSlackMonitor(c *SlackConfig) (*SlackMonitor, error)

NewSlackMonitor creates new Slack message monitor

func (*SlackMonitor) Channel

func (s *SlackMonitor) Channel() string

Channel returns the name of the Slack channel which we monitor

func (*SlackMonitor) MonitorAndAlert

func (s *SlackMonitor) MonitorAndAlert(msgChan chan<- *alertify.Msg) error

MonitorAndAlert monitors channel and notifies alertify Bot when the preconfigured message regexp is matched

func (*SlackMonitor) Stop

func (s *SlackMonitor) Stop()

Stop stops Slack event watched

func (*SlackMonitor) String

func (s *SlackMonitor) String() string

String returns the name of the monitor

func (*SlackMonitor) User

func (s *SlackMonitor) User() string

User returns slack user name whose message we monitor

Jump to

Keyboard shortcuts

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