ircon

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: BSD-2-Clause Imports: 5 Imported by: 2

Documentation

Overview

Package ircon maintains a connection to the Twitch IRC service.

Index

Constants

View Source
const DefaultCaps = "twitch.tv/tags twitch.tv/commands"

DefaultCaps is the default set of capabilities. The twitch.tv/membership capability is omitted for performance reasons and its general lack of usefulness in most scenarios.

View Source
const DefaultServer = "wss://irc-ws.chat.twitch.tv/"

DefaultServer is the default Twitch "IRC" server used by e.g. web chat

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Connected()
	Disconnected(err error)
	Message(*irc.Message)
}

A Handler receives events from IRCon.

type IRCon

type IRCon struct {
	// Caps contains the set of capabilities that are requested on connect.
	// Advanced users can specify their own set.
	Caps string

	Handler Handler
	// contains filtered or unexported fields
}

An IRCon is an automatically reconnecting IRC connection.

func New

func New(nick, passwd string) *IRCon

New creates a new IRCon with the given credentials.

func (*IRCon) Background

func (i *IRCon) Background(ctx context.Context)

Background runs the connection in a background goroutine until ctx is done.

func (*IRCon) Send

func (i *IRCon) Send(s string)

Send sends a message to the currently active IRC connection. If there is no active connection, the message is lost.

type Message

type Message = irc.Message

Message aliases irc.Message for import convenience.

Jump to

Keyboard shortcuts

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