oodle

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUsage = errors.New("Wrong command usage")

Functions

This section is empty.

Types

type BaseTrigger

type BaseTrigger struct {
	SendQueue chan string
}

BaseTrigger is just an implementation of Trigger to reduce some boilerplate code

func (*BaseTrigger) SetSendQueue

func (btrigger *BaseTrigger) SetSendQueue(sendqueue chan string)

type Bot

type Bot interface {
	RegisterTrigger(trigger Trigger)
	RegisterCommand(command Command)
}

type Command

type Command interface {
	Info() CommandInfo
	Execute(nick string, args []string) (reply string, err error)
}

Command is like a pure function just inputs and outputs

type CommandInfo

type CommandInfo struct {
	Prefix      string
	Name        string
	Description string
	Usage       string
}

CommandInfo contains information of a command

type Config

type Config struct {
	Nick        string `toml:"nick"`
	Name        string `toml:"name"`
	User        string `toml:"user"`
	Server      string `toml:"server"`
	Port        int    `toml:"port"`
	Channel     string `toml:"channel"`
	Retry       bool   `toml:"retry"`
	SASLUser    string `toml:"sasl_user"`
	SASLPass    string `toml:"sasl_pass"`
	DBPath      string `toml:"dbpath"`
	WebHookAddr string `toml:"webhook_addr"`
	Secret      string `toml:"secret"`
}

type Join

type Join struct {
	Nick string
}

type Leave

type Leave struct {
	Nick string
}

type Message

type Message struct {
	Nick string
	Msg  string
}

Simpified IRC events

type Stateful added in v0.2.0

type Stateful interface {
	Init(config *Config, db *gorm.DB)
}

type Trigger

type Trigger interface {
	SetSendQueue(sendqueue chan string)
	OnEvent(event interface{})
}

Trigger can listen for a event and get triggered and send messages via. the send queue

Jump to

Keyboard shortcuts

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