roll

package module
v0.0.0-...-2f9a7ba Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: BSD-2-Clause Imports: 25 Imported by: 0

README

roll

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterModuleFactory

func RegisterModuleFactory(f ModuleFactory, name string) error

Types

type AdminWebProvider

type AdminWebProvider interface {
	GetAdminHandler() http.Handler
}

AdminWebProvider is implemented by modules that serve admin web pages.

type Bot

type Bot struct {
	Config *Config
	// contains filtered or unexported fields
}

Bot is the main object that represents the bot.

func NewBot

func NewBot(config *Config) (*Bot, error)

NewBot creates a new, unconnected bot.

func (*Bot) AddCommand

func (b *Bot) AddCommand(name string, help string,
	handler func(*CommandContext, []string) error,
	userLevel int) error

AddCommand adds a bot command.

func (*Bot) AddModule

func (b *Bot) AddModule(modType string) error

func (*Bot) AddModuleByName

func (b *Bot) AddModuleByName(modType string, name string) error

func (*Bot) AddTemplateFunc

func (b *Bot) AddTemplateFunc(name string, f interface{}) error

func (*Bot) Connect

func (b *Bot) Connect() error

Connect the bot to Twitch.

func (*Bot) Irc

func (b *Bot) Irc() *twitch.Client

func (*Bot) IsAdminRequest

func (b *Bot) IsAdminRequest(r *http.Request) bool

func (*Bot) RemoveCommand

func (b *Bot) RemoveCommand(name string) error

RemoveCommand removes a bot command.

type CmdEngine

type CmdEngine struct {
	*cmd.Engine
}

func NewCmdEngine

func NewCmdEngine() *CmdEngine

func (*CmdEngine) AddCommand

func (e *CmdEngine) AddCommand(name string, help string,
	handler func(*CommandContext, []string) error,
	userLevel int) error

type CommandContext

type CommandContext struct {
	Bot     *Bot
	Channel string
	User    *twitch.User
	Message *twitch.Message

	UserLevel int

	API *twitchapi.Connection
	IRC *twitch.Client
}

CommandContext is passed to commands that are executed.

type Config

type Config struct {
	BotUsername string `json:"bot_username"`
	Channel     string `json:"channel"`
	APIOAuth    string `json:"api_oauth"`
	IRCOAuth    string `json:"irc_oauth"`
	IRCAddress  string `json:"irc_addr"`
	APIURLBase  string `json:"api_url_base"`
	AdminUser   string `json:"admin_user"`

	ClientID string `json:"client_id"`

	HTTPAddr         string `json:"http_addr"`
	HTTPSAddr        string `json:"https_addr"`
	HTTPRedirectBase string `json:"http_redirect_base"`
	KeyFile          string `json:"key_file"`
	CertFile         string `json:"cert_file"`

	DBPath string `json:"db_path"`
}

Config is the bot's configuration

func LoadConfig

func LoadConfig(fileName string) (*Config, error)

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type Module

type Module interface {
	Start() error
	Stop() error
}

Module is the basic interface for bot modules.

type ModuleFactory

type ModuleFactory func(bot *Bot, dbBucket storm.Node) (Module, error)

ModuleFactory functions create modules.

type PublicWebProvider

type PublicWebProvider interface {
	GetPublicHandler() http.Handler
}

PublicWebProvider is implemented by modules that serve public web pages.

type RPCServiceProvider

type RPCServiceProvider interface {
	GetRPCService() interface{}
}

RPCServiceProvider is implemented my modules that handle rpc requests.

type Time

type Time struct {
	time.Time
}

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(b []byte) error

Directories

Path Synopsis
cmd
modules

Jump to

Keyboard shortcuts

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