util

package
v0.0.0-...-d3a11ce Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package util contains common functionality for "utilities" required by the bot.

This file is for processing the application's configuration from a YAML file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	IRC              *ircConfig               `yaml:"irc"`
	Plugins          map[string]*pluginConfig `yaml:"plugins"`
	UnparsedLogLevel string                   `yaml:"log_level"`

	LogLevel logrus.Level
}

Config contains the entire application's configuration.

func NewConfig

func NewConfig(params ...string) *Config

NewConfig sets up the application's configuration.

func (*Config) EnabledPlugins

func (c *Config) EnabledPlugins() []string

type Plugin

type Plugin struct {
	// Contrib is the external plugin.
	Contrib contrib.Plugin
}

Plugin is a contributed plugin. It is wrapped with this struct so the Run function can be added for running user input against commands.

func LoadPlugins

func LoadPlugins(filenames []string) ([]*Plugin, []error)

LoadPlugins loads contributed plugins by filename. Any plugin which fails to load or doesn't have the correct function will instead add an error to the errors list.

func (*Plugin) Run

func (p *Plugin) Run(c *command.Command) []*command.Response

Run runs user input against the commands in the contributed plugin. Any command which returns input will be added to Run's output list.

Jump to

Keyboard shortcuts

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