core

package
v0.0.0-...-bd7e42f Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPipingError

func IsPipingError(err error) bool

func RunCommand

func RunCommand(loadedModules []Module, command Command, commandPrefix string) ([]string, error)

Types

type Base

type Base struct {
	Config config.Config
	Sender Sender

	Log logging.Logger
	// contains filtered or unexported fields
}

func NewBase

func NewBase(moduleName string, sender Sender, conf config.Config) Base

func (*Base) AddCommand

func (b *Base) AddCommand(name string, moduleCommand ModuleCommand)

func (*Base) GetCommandArguments

func (b *Base) GetCommandArguments(msg string) ([]string, error)

func (*Base) GetCommandName

func (b *Base) GetCommandName(msg string) (string, error)

func (*Base) HandleEvent

func (b *Base) HandleEvent(event *irc.Event)

func (*Base) RunCommand

func (b *Base) RunCommand(command Command) ([]string, error)

type Command

type Command struct {

	// Text of the command for example ".command argument1 argument2".
	Text string

	// Nick of the person that sent this command for example "nick".
	Nick string

	// Target of the message. A channel name or a nick if the bot is
	// messaged directly. Example: "#channel" or "bot_nick".
	Target string
}

type CommandArguments

type CommandArguments struct {
	Arguments []string
	Nick      string
	Target    string
}

type Module

type Module interface {
	HandleEvent(event *irc.Event)

	RunCommand(command Command) ([]string, error)
}

type ModuleCommand

type ModuleCommand func(arguments CommandArguments) ([]string, error)

type Sender

type Sender interface {
	Reply(e *irc.Event, text string)
	Message(target string, text string)
}

func NewSender

func NewSender(conn *irc.Connection) Sender

Jump to

Keyboard shortcuts

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