Documentation
¶
Index ¶
- func ClearHandlers()
- func ClearJobs()
- func Load(dir string)
- func RegisterAll(dir string)
- func RegisterHandlers()
- func RegisterJob(job bot.JobInfo)
- func RegisterJobConcurrent(job bot.JobInfo, addGlobally bool)
- func RegisterJobs()
- func SaveConfig()
- func SetupConfigSaving()
- func Shutdown()
- func Startup()
- type Plugin
- type PluginInit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearHandlers ¶
func ClearHandlers()
ClearHandlers will go through bot.Handlers and handle the de-registration of them
func RegisterAll ¶
func RegisterAll(dir string)
RegisterAll will register all bot features, and then load plugins
func RegisterHandlers ¶
func RegisterHandlers()
RegisterHandlers will go through bot.Handlers and handle the re-registration of them
func RegisterJob ¶
RegisterJob registers a job for use with gocron. Ensure you add the job to bot.Jobs for de-registration with ClearJobs.
func RegisterJobConcurrent ¶
RegisterJobConcurrent registers a job with RegisterJob concurrently, and optionally adds the job to bot.Jobs to be tracked.
func RegisterJobs ¶
func RegisterJobs()
RegisterJobs will go through bot.Jobs and handle the re-registration of them
func SetupConfigSaving ¶
func SetupConfigSaving()
SetupConfigSaving will run each plugin's SaveConfig every 5 minutes with a ticker
Types ¶
type Plugin ¶
type Plugin struct { Name string // Name of the plugin to display to users Description string // Description of what the plugin does Version string // Version in semver, e.g.., 1.1.0 Config interface{} // Config is the Plugin's config, can be nil ConfigDir string // ConfigDir is the name of the config directory ConfigType reflect.Type // ConfigType is the type to validate parse the config with Commands []bot.CommandInfo // Commands to register, could be none Responses []bot.ResponseInfo // Responses to register, could be none Handlers []bot.HandlerInfo // Handlers to register, could be none Jobs []bot.JobInfo // Jobs to register, could be none StartupFn func() // ShutdownFn is a function to be called when the bot starts up ShutdownFn func() // ShutdownFn is a function to be called when the bot shuts down }
func (*Plugin) LoadConfig ¶
func (p *Plugin) LoadConfig() (i interface{})
func (*Plugin) Register ¶
func (p *Plugin) Register()
Register will register a plugin's commands, responses and jobs to the bot
func (*Plugin) SaveConfig ¶
func (p *Plugin) SaveConfig()
type PluginInit ¶
type PluginInit struct {
ConfigDir string
}