Documentation ¶
Overview ¶
Package irc provides a framework for writing IRC clients, specifically bots.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrBadMsg = errors.New("Invalid IRC message.")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an IRC connection which handles message dispatch to a MsgHandler.
type CmdHandler ¶
type CmdHandler struct {
// contains filtered or unexported fields
}
A CmdHandler dispatches for a group of commands with a common prefix.
func NewCmdHandler ¶
func NewCmdHandler(prefix string) *CmdHandler
NewCmdHandler creates a new CmdHandler with the given command prefix.
func (*CmdHandler) Accepts ¶
func (c *CmdHandler) Accepts(msg *Msg) bool
Accepts for a CmdHandler ensures the msg contains a chat command.
func (*CmdHandler) Handle ¶
func (c *CmdHandler) Handle(msg *Msg, send chan<- *Msg)
Handle for a CmdHandler extracts the relevant parts of a command msg and dispatches to a Cmd, if one is found with the given name.
func (*CmdHandler) Register ¶
func (c *CmdHandler) Register(name string, cmd Cmd)
Register adds a Cmd to be executed when the given name is matched.
func (*CmdHandler) RegisterFunc ¶
func (c *CmdHandler) RegisterFunc(name string, cmdFunc CmdFunc)
RegisterFunc adds a CmdFunc to be executed when the given name is matched.
func (*CmdHandler) RegisteredNames ¶
func (c *CmdHandler) RegisteredNames() (names []string)
type Msg ¶
Msg represents the essential components identifying a received for to-be-sent IRC message.
func (*Msg) ExtractNick ¶
ExtractNick attempts to extract the sender nick from the message prefix.
func (*Msg) ExtractPrivmsg ¶
ExtractPrivmsg attempts to extract the relevant parts of a privmessage.