mouse

package
v0.0.0-...-4bf1c35 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionWaiting = iota
	ConnectionAlive
	ConnectionDead
)

Connection constants represent different stages of a connection.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host          string
	Port          int
	Nick          string
	User          string
	Name          string
	Pass          string
	Channels      []string
	Reconnect     bool
	Ping          time.Duration
	TLS           bool
	TLSConfig     *tls.Config
	Storage       storage.Storage
	StorageDriver string
}

A Config represents a configuration object for a Mouse

type Event

type Event struct {
	Channel string
	Command string
	Host    string
	Message string
	Nick    string
	User    string
}

An Event represents an IRC event

type Mouse

type Mouse struct {
	Config  *Config
	Storage *storage.Store
	// contains filtered or unexported fields
}

A Mouse represents an IRC bot

func New

func New(config Config) (*Mouse, error)

New creates a new IRC bot. If there are any problems creating the bot, or connecting to storage, this returns an error.

func (*Mouse) Ban

func (mouse *Mouse) Ban(channel, user, reason string) error

Ban allows the bot to ban a user out of a specific channel. While you must pass a parameter as a reason, if you don't want to send an actual reason, you can pass an empty string.

func (*Mouse) Connect

func (mouse *Mouse) Connect() error

Connect creates a new connection to the IRC server defined in the Config. If there are any problems connecting, this will return an error.

func (*Mouse) Deop

func (mouse *Mouse) Deop(channel, nick string) error

Deop allows the bot to change the mode to -o of a user given in a specific channel.

func (*Mouse) Join

func (mouse *Mouse) Join(channel string) error

Join allows the bot to join a channel. If there is a password for the channel the bot is trying to join, append it with a space after the channel name.

func (*Mouse) Kick

func (mouse *Mouse) Kick(channel, user, reason string) error

Kick allows the bot to kick a user out of a specific channel. While you must pass a parameter as a reason, if you don't want to send an actual reason, you can pass an empty string.

func (*Mouse) Op

func (mouse *Mouse) Op(channel, nick string) error

Op allows the bot to change the mode to +o of a user given in a specific channel.

func (*Mouse) Part

func (mouse *Mouse) Part(channel string) error

Part allows the bot to part a channel.

func (*Mouse) Say

func (mouse *Mouse) Say(channel, message string) error

Say allows the bot to send a PRIVMSG to a channel.

func (*Mouse) Unban

func (mouse *Mouse) Unban(channel, user string) error

Unban allows the bot to unban a user in a specific channel.

func (*Mouse) Use

func (mouse *Mouse) Use(handler func(*Event))

Use adds a handler function to the stack of handlers for IRC events.

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

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