Documentation
¶
Index ¶
- type Client
- func (c *Client) CurrentNick() string
- func (c *Client) DoneChan() <-chan struct{}
- func (c *Client) Run(ctx context.Context) error
- func (c *Client) SendMessage(target, message string) error
- func (c *Client) SendMessageChunked(target, message string) error
- func (c *Client) SendMessagef(target, format string, args ...interface{}) error
- func (c *Client) SendNotice(target, message string) error
- func (c *Client) SendNoticeChunked(message, target string) error
- func (c *Client) SendNoticef(target, format string, args ...interface{}) error
- func (c *Client) SetMessageHandler(handler event.MessageHandler)
- func (c *Client) Stop(message string)
- func (c *Client) ToggleRawLog()
- func (c *Client) WaitForExit()
- func (c *Client) Write(data []byte) (int, error)
- func (c *Client) WriteIRC(command string, params ...string) error
- func (c *Client) WriteString(s string) (int, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements a full IRC client for use in bots. It does most of the work in connecting and otherwise handling the protocol
func (*Client) CurrentNick ¶
CurrentNick returns what the Client believes its current nick is. It is safe for concurrent use. A client created with New() will internally handle tracking nick changes.
func (*Client) DoneChan ¶
func (c *Client) DoneChan() <-chan struct{}
DoneChan returns a channel that will be closed when the connection is closed
func (*Client) SendMessage ¶
SendMessage sends a PRIVMSG to the given target with the given message.
func (*Client) SendMessageChunked ¶
SendMessageChunked will use SendMessage to send your message, but if the message is over the max for an IRC message, it will split it into chunks, and send each one individually.
This is mostly intended for use with things like chatcommand.Handler that dont know how long their messages will be. If you can, you likely want to do this manually, as the chunking this uses is not intelligent at all.
func (*Client) SendMessagef ¶
SendMessagef is like SendMessage but with printf formatting
func (*Client) SendNotice ¶
SendNotice sends a NOTICE to the given target with the given message
func (*Client) SendNoticeChunked ¶
SendNoticeChunked will use SendNotice to send your message, but if the message is over the max for an IRC message, it will split it into chunks, and send each one individually.
This is mostly intended for use with things like chatcommand.Handler that dont know how long their messages will be. If you can, you likely want to do this manually, as the chunking this uses is not intelligent at all.
func (*Client) SendNoticef ¶
SendNoticef is like SendNotice but with printf formatting
func (*Client) SetMessageHandler ¶
func (c *Client) SetMessageHandler(handler event.MessageHandler)
SetMessageHandler sets the callback handler for incoming IRC Messages
func (*Client) ToggleRawLog ¶
func (c *Client) ToggleRawLog()
ToggleRawLog enables or disables raw IRC line logging
func (*Client) WaitForExit ¶
func (c *Client) WaitForExit()
WaitForExit blocks until the connection is closed
func (*Client) Write ¶
Write implements io.Writer. See WriteIRC for a nicer frontend for creating IRC lines
type Config ¶
type Config struct { Connection connection.Config ServerPassword string Nick string Username string Realname string SASLUsername string SASLPassword string RequestedCapabilities []string // contains filtered or unexported fields }
Config is a startup configuration for a client instance