seras

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bots map[string]Bot

Functions

func AddBotParser

func AddBotParser(name string, parser BotParser) error

func ParseBots

func ParseBots(cfg *Config) error

func RunBot

func RunBot(bot Bot) error

func Token

func Token() string

Types

type Actions

type Actions interface {
	Messenger
	MessageFormatter
	Admin
}

type Admin

type Admin interface {
	IsAdmin(userId string) bool
	TimeoutUser(channel string, user string, until time.Time) error
}

type Author

type Author struct {
	Id      string // Host in IRC, User ID in Discord.
	Nick    string
	Mention string // TODO: Refactor?, this is quick fix to get mentions working in Discord.
}

type Bot

type BotParser

type BotParser interface {
	Parse(map[string]interface{}) (Bot, error)
}

type Config

type Config struct {
	Mods []string
	Bots map[string]map[string]interface{}
}

func ParseToml

func ParseToml(file string) (*Config, error)

type Connection

type Connection interface {
	Connect() (Stream, error)
	Close() error
}

type Message

type Message struct {
	Content   string
	Arguments []string
	Channel   string
	Author    Author
}

func (*Message) Command

func (msg *Message) Command(command string, call func(Message))

func (*Message) IsCommand

func (msg *Message) IsCommand(command string) bool

type MessageFormatter

type MessageFormatter interface {
	Bold(string) string
	Italicize(string) string
}

type Messenger

type Messenger interface {
	Send(Message) error
	Reply(Message, string) error
}

type Modable

type Modable interface {
	Mods() []Module
	AddMods([]Module)
}

type Module

type Module interface {
	Name() string
	Start(Stream, Actions) error
	Stop()
}

type ModuleManager

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

func NewModManager

func NewModManager(mods []Module, actions Actions) (*ModuleManager, error)

func (*ModuleManager) Run

func (manager *ModuleManager) Run(stream Stream) error

func (*ModuleManager) Stop

func (manager *ModuleManager) Stop()

type NullMessenger

type NullMessenger struct{}

func (*NullMessenger) Send

func (messenger *NullMessenger) Send(msg Message) error

type Stream

type Stream <-chan Message

Directories

Path Synopsis
cmd
seras command
connections
irc
rss
sed
Package sed is a toy implementation of sed for making _real_ corrections only, no silly seds.
Package sed is a toy implementation of sed for making _real_ corrections only, no silly seds.
storage

Jump to

Keyboard shortcuts

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