haleakala

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: MIT Imports: 10 Imported by: 0

README

Haleakala

Haleakala is a Discord Bot written in Go with a focus for EVE Online corporations. It provides a modular plugin system for adding new commands. IRC pings can be relayed to discord via a ZNC plugin.

Requirements

  • libzmq4 for IRC relaying to Discord

Build

make build

Acknowledgements

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CurrentVersion is set by the linker and contains the Git Commit hash
	CurrentVersion = ""
	// BuildTime is set by the linker and includes the time in UTC on which the bot was compiled
	BuildTime = ""
)
View Source
var DefaultAdminMiddleware muxer.HandlerFunc = nil

Functions

func AllowOnCertainChannels

func AllowOnCertainChannels(chanids []string) muxer.HandlerFunc

func GetListOfPlugins

func GetListOfPlugins() []string

func Register

func Register(name string, plugin IPluginInitalizer)

Register makes a plugin available to the system

func StrSliceContainsStr

func StrSliceContainsStr(s string, slice []string) bool

StrSliceContainsStr returns a boolean if s is found in slice

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context TODO

func New

func New(configPath string) (*Context, error)

func (*Context) InitializePlugin

func (s *Context) InitializePlugin(f IPlugin) error

InitializePlugin registers a plugin with the bot & router

func (*Context) InstallRoute

func (s *Context) InstallRoute(command, description string, middlewares ...muxer.HandlerFunc) error

installRoute installs a new command into the bot

func (*Context) ListLoadedPlugins

func (s *Context) ListLoadedPlugins(ctx *muxer.Context)

func (*Context) LoadPlugin

func (s *Context) LoadPlugin(ctx *muxer.Context)

func (*Context) Start

func (s *Context) Start() error

Start connects to discord and starts listening for messages

func (*Context) Stop

func (s *Context) Stop() error

Stop will end the bot safely

func (*Context) UnloadPlugin

func (s *Context) UnloadPlugin(ctx *muxer.Context)

type DatabaseConfig

type DatabaseConfig struct {
	Path string `json:"path"`
}

type IBasicPlugin

type IBasicPlugin interface {
	// Name returns the name of the plugin
	Name() string
	// InstallRoute TODO
	InstallRoute(InstallFunc) error
}

type IPlugin

type IPlugin interface {
	Destroy() error
	// SupportsUnload returns a boolean if this plugin should be allowed to be !unloaded via a command
	SupportsUnload() bool

	IBasicPlugin
}

IPlugin defines an interface that plugins can use to embedd into the bot process that are "long running" or maintain some level of state throughout the lifecycle of the bot

type IPluginInitalizer

type IPluginInitalizer interface {
	Initialize(PluginConfigVars, *discordgo.Session, storm.Node) (IPlugin, error)
}

func GetPlugin

func GetPlugin(name string) IPluginInitalizer

type InstallFunc

type InstallFunc func(command, description string, middlewares ...muxer.HandlerFunc) error

type PluginConfig

type PluginConfig struct {
	PluginName string          `yaml:"name" json:"name"`
	Enabled    bool            `yaml:"enabled" json:"enabled"`
	Config     json.RawMessage `yaml:"config" json:"config"`
}

type PluginConfigVars

type PluginConfigVars json.RawMessage

Directories

Path Synopsis
cmd
Package muxer provides a simple Discord message route multiplexer that parses messages and then executes a matching registered handler, if found.
Package muxer provides a simple Discord message route multiplexer that parses messages and then executes a matching registered handler, if found.

Jump to

Keyboard shortcuts

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