core

package
v0.0.0-...-38c0829 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(bot *models.Bot)

Configure searches the config directory for the bot.yml to create a Bot object. The Bot object will be passed around to make accessible system-specific information.

func Matcher

func Matcher(inputMsgs <-chan models.Message, outputMsgs chan<- models.Message, rules map[string]models.Rule, hitRule chan<- models.Rule, bot *models.Bot)

Matcher will search through the map of loaded rules, determine if a rule was hit, and process said rule to be sent out as a message.

func Outputs

func Outputs(outputMsgs <-chan models.Message, hitRule <-chan models.Rule, bot *models.Bot)

Outputs determines where messages are output based on fields set in the bot.yml TODO: Refactor to keep remote specifics in remote/.

func Prommetric

func Prommetric(input string, bot *models.Bot)

Prommetric creates a local Prometheus server to rule metrics.

func Remotes

func Remotes(inputMsgs chan<- models.Message, rules map[string]models.Rule, bot *models.Bot)

Remotes - the purpose of this function is to READ incoming messages from various places, i.e. remotes. Whenever a message is read from a remote, the `inputMsgs` channel will store the read message as a 'Message' object and pass it along to the Matcher function (see '/core/matcher.go') for processing. Currently, we support 3 types of remotes: chat applications, CLI, and Scheduler. Remote 1: Chat applications

This remote allows us to read messages from various chat application platforms, e.g. Slack, Discord, etc.
We typically read the messages from these chat applications using their respective APIs.
* Note: right now we only support reading from one chat application at a time.

Remote 2: CLI

This remote is enabled when 'CLI mode' is set to true in the bot.yml configuration.
Messages from this remote are read from the user's input via the terminal.

Remote 3: Scheduler

This remote allows us to read messages being sent internally by a running cronjob
created by a schedule type rule, e.g. see '/config/rules/schedule.yml'.

TODO: Refactor to keep remote specific stuff in remote/.

func Rules

func Rules(rules *map[string]models.Rule, bot *models.Bot)

Rules - searches the rules directory for any existing .yml rules and proceeds to create Rule objects for each .yml rule, and then finally populates a rules map with said Rule objects. The rules map is used to dictate the bots behavior and response patterns.

Types

This section is empty.

Jump to

Keyboard shortcuts

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