core

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCommandPrefix = '&'
	DefaultDirPath       = "/store"
)

Variables

This section is empty.

Functions

func Tokenize

func Tokenize(s string) (tok []string, err error)

Split the message content by spaces while leaving segments in quotes intact Uses regex

Types

type Registry

type Registry struct {
	Interceptors    map[gb.Command]gb.Interceptor // all built-in interceptors
	DirPath         string                        // path to local data
	CommandPrefix   uint8                         // character that precedes all Gobottas commands
	DiscussionQueue *discussion.Queue             // the data structure that holds discussion queue data
}

Contains Gobottas functions and data

func NewRegistry

func NewRegistry(opts ...RegistryOpt) *Registry

func (*Registry) Execute

func (r *Registry) Execute(msg *gb.Message, s gb.Session) error

Calls the Executor to which the Registry points for the Message CommandType

func (*Registry) Intercept

func (r *Registry) Intercept(msg *gb.Message) error

Function to call all Interceptors on a message

func (*Registry) Parse

func (r *Registry) Parse(dMsg *discordgo.Message) (cmd *gb.Message, err error)

Function to parse incoming messages

type RegistryOpt

type RegistryOpt func(*Registry)

func WithInterceptor

func WithInterceptor(c gb.Command, i gb.Interceptor) RegistryOpt

set the interceptor for the given command type; will overwrite any existing interceptor

func WithPath

func WithPath(s string) RegistryOpt

func WithPrefix

func WithPrefix(p uint8) RegistryOpt

func WithQueue

func WithQueue(q *discussion.Queue) RegistryOpt

Opt Functions

Jump to

Keyboard shortcuts

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