Documentation
¶
Overview ¶
Package irc provides a Twitch IRC client for chat message ingestion.
Index ¶
- Constants
- type AuthMode
- type ChannelChangeHandler
- type Client
- func (c *Client) AuthMode() AuthMode
- func (c *Client) Channels() []string
- func (c *Client) Connect(ctx context.Context) error
- func (c *Client) Disconnect() error
- func (c *Client) IsAnonymous() bool
- func (c *Client) IsConnected() bool
- func (c *Client) Join(channel string) error
- func (c *Client) Part(channel string) error
- type ClientConfig
- type Message
- type MessageHandler
Constants ¶
const ( // TwitchIRCServerTLS is the Twitch IRC server address for TLS connections. TwitchIRCServerTLS = "irc.chat.twitch.tv:6697" // TwitchIRCServer is the Twitch IRC server address (non-TLS, deprecated). // Prefer TwitchIRCServerTLS for secure connections. TwitchIRCServer = "irc.chat.twitch.tv:6667" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelChangeHandler ¶
ChannelChangeHandler is called when channel join/part is requested.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Twitch IRC client.
func (*Client) Connect ¶
Connect establishes a TLS connection to Twitch IRC. The context is used for cancellation during the connection process.
func (*Client) Disconnect ¶
Disconnect closes the IRC connection.
func (*Client) IsAnonymous ¶
IsAnonymous returns true if the client is using anonymous (justinfan) mode. In anonymous mode, the client is read-only and cannot send messages.
func (*Client) IsConnected ¶
IsConnected returns true if the client is connected.
type ClientConfig ¶
type ClientConfig struct {
AuthMode AuthMode // "authenticated" or "anonymous"
Username string // Required for authenticated, optional for anonymous
OAuthToken string // Required for authenticated, must be empty for anonymous
OnMessage MessageHandler
OnChannelChange ChannelChangeHandler
}
ClientConfig holds IRC client configuration.
type Message ¶
type Message struct {
Channel string
Username string
DisplayName string
Text string
Tags map[string]string
ReceivedAt time.Time
}
Message represents a parsed IRC PRIVMSG.
type MessageHandler ¶
type MessageHandler func(msg Message)
MessageHandler is called for each incoming chat message.