noye

package
v0.0.0-...-a45123f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2014 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot interface {
	Dial(addr, nick, user string) error
	Close()

	Send(f string, a ...interface{})
	Privmsg(target, msg string)

	Join(target string)
	Part(target string)

	Quit()

	Wait() <-chan struct{}
	Ready() <-chan struct{}

	Manager() Manager
}

Bot is an abstract contract for an IRC Bot

type Conn

type Conn interface {
	Dial(addr string) error
	Close()

	WriteLine(raw string)
	ReadLine() (string, error)
}

Conn is an abstract interface for an IRC connection

type IrcMessage

type IrcMessage struct {
	Source  User
	Command string
	Args    []string
	Text    string
	Raw     string
}

IrcMessage is a representation of a raw IRC message

type Manager

type Manager interface {
	Respond(msg Message)
	Listen(msg IrcMessage)

	LoadScripts(dir string)
	LoadFile(path string) error

	Reload(script string) error
	ReloadBase() error

	Unload(name string) error
	UnloadAll()

	Scripts() map[string]Script
}

Manager represents a set of managed scripts

type Message

type Message struct {
	Target, Text string
	From         User
}

Message is a simple message

type MockBot

type MockBot struct {
	DialFn  func(string, string, string) error
	CloseFn func()

	SendFn    func(string, ...interface{})
	PrivmsgFn func(string, string)

	JoinFn func(string)
	PartFn func(string)
	QuitFn func()

	WaitFn  func() <-chan struct{}
	ReadyFn func() <-chan struct{}

	ManagerFn func() Manager
}

MockBot is a type that implements noye.Bot which can have parts of it overridden by changing the functors

func NewMockBot

func NewMockBot() *MockBot

NewMockBot returns a new MockBot with the fns set to no-ops

func (*MockBot) Close

func (m *MockBot) Close()

Close delegates to CloseFn

func (*MockBot) Dial

func (m *MockBot) Dial(addr, nick, user string) error

Dial delegates to DialFn

func (*MockBot) Join

func (m *MockBot) Join(target string)

Join delegates to JoinFn

func (*MockBot) Manager

func (m *MockBot) Manager() Manager

Manager delegates to ManagerFn

func (*MockBot) Part

func (m *MockBot) Part(target string)

Part delegates to PartFn

func (*MockBot) Privmsg

func (m *MockBot) Privmsg(target, msg string)

Privmsg delegates to PrivmsgFn

func (*MockBot) Quit

func (m *MockBot) Quit()

Quit delegates to QuitFn

func (*MockBot) Ready

func (m *MockBot) Ready() <-chan struct{}

Ready delegates to ReadyFn

func (*MockBot) Send

func (m *MockBot) Send(f string, a ...interface{})

Send delegates to SendFn

func (*MockBot) Wait

func (m *MockBot) Wait() <-chan struct{}

Wait delegates to WaitFn

type MockConn

type MockConn struct {
	DialFn      func(string) error
	CloseFn     func()
	WriteLineFn func(string)
	ReadLineFn  func() (string, error)
}

MockConn is a type that implements noye.Conn which can have parts of it overridden by changing the functors

func NewMockConn

func NewMockConn() *MockConn

NewMockConn returns a new MockConn with the fns set to no-ops

func (*MockConn) Close

func (m *MockConn) Close()

Close delegates to CloseFn

func (*MockConn) Dial

func (m *MockConn) Dial(addr string) error

Dial delegates to DialFn

func (*MockConn) ReadLine

func (m *MockConn) ReadLine() (string, error)

ReadLine delegates to ReadLineFn

func (*MockConn) WriteLine

func (m *MockConn) WriteLine(raw string)

WriteLine delegates to WriteLineFn

type Script

type Script interface {
	Name() string
	Path() string
	Source() string
	Cleanup()
}

Script represents a script

type User

type User struct {
	Nick, User, Host string
}

User represents an IRC user

func (User) String

func (u User) String() string

Jump to

Keyboard shortcuts

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