Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( IGNORECASE = "(?i)" F1 = regexp.MustCompile(IGNORECASE + "^\\.f1") LUNCH = regexp.MustCompile(IGNORECASE + "^\\.lunch (.*)") LUNCHES = regexp.MustCompile(IGNORECASE + "^\\.lunches") TACOS = regexp.MustCompile(IGNORECASE + "^\\.tacos") QUESTION = regexp.MustCompile(IGNORECASE + "^leif(.*)\\?") INSULT = regexp.MustCompile(IGNORECASE + "^\\.insult (.*)") HELP = regexp.MustCompile(IGNORECASE + "^\\.help") DECIDE = regexp.MustCompile(IGNORECASE + "^\\.decide") FLIP = regexp.MustCompile(IGNORECASE + "^\\.flip") TLDR = regexp.MustCompile(IGNORECASE + "^\\.tldr (.*)") LOG = regexp.MustCompile(IGNORECASE + "^\\.log (.*)") GITLAB = regexp.MustCompile(IGNORECASE + "^\\.gitlab (.*)") POSTMORD = regexp.MustCompile(IGNORECASE + "^\\.postmord (.*)") CORONA = regexp.MustCompile(IGNORECASE + "^\\.corona (.*)") SUGGEST = regexp.MustCompile(IGNORECASE + "^\\.suggest") JIRA = regexp.MustCompile(IGNORECASE + "^\\.jira (.*)") )
Functions ¶
func GetLogRecords ¶
GetLogRecords collects all logs for a specific log level
func HandleResponse ¶
func HandleResponse(message interface{}, event *slack.MessageEvent, client *slack.Client, logger *logrus.Logger)
HandleResponse type checks the input message and sends the response to specified slack channel
func InitLogger ¶
InitLogger creates a new logrus logger using a multiwriter and returns it
Types ¶
type Config ¶
type Config struct { SlackToken string `env:"SLACK_TOKEN,required"` GitLabToken string `env:"GITLAB_TOKEN"` GitLabURL string `env:"GITLAB_BASE_URL"` PostMordToken string `env:"POSTMORD_TOKEN"` JIRAURL string `env:"JIRA_URL"` JIRAUsername string `env:"JIRA_USERNAME"` JIRAToken string `env:"JIRA_TOKEN"` }
Config app configuration
type EventHandler ¶
type EventHandler struct { Client *slack.Client Cache cache.Cache Logger *logrus.Logger Config Config }
EventHandler provides methods to handle slack events
func (EventHandler) Handle ¶
func (e EventHandler) Handle(msg slack.RTMEvent)
Handle filters bot events and passes events to respective sub handler
Click to show internal directories.
Click to hide internal directories.