tmi

package module
v0.0.0-...-e06e946 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: MIT Imports: 8 Imported by: 0

README

tmi

Documentation

Index

Constants

View Source
const (
	// CapMembership adds membership state event data.
	CapMembership = "twitch.tv/membership"
	// CapTags adds IRC V3 message tags to several commands.
	CapTags = "twitch.tv/tags"
	// CapCommands enables several Twitch-specific commands.
	CapCommands = "twitch.tv/commands"
)
View Source
const (
	Delim = "\r\n"
)

Variables

This section is empty.

Functions

func SSL

func SSL(c *Client) error

Types

type CLEARCHAT

type CLEARCHAT Packet // Purge a user’s message(s), typically after a user is banned from chat or timed out.

func (*CLEARCHAT) Channel

func (p *CLEARCHAT) Channel() string

func (*CLEARCHAT) Nick

func (p *CLEARCHAT) Nick() string

type CLEARMSG

type CLEARMSG Packet // Single message removal on a channel. This is triggered via /delete <target-msg-id> on IRC.

func (*CLEARMSG) Channel

func (p *CLEARMSG) Channel() string

func (*CLEARMSG) Login

func (p *CLEARMSG) Login() (string, error)

func (*CLEARMSG) Message

func (p *CLEARMSG) Message() string

func (*CLEARMSG) TargetMsgID

func (p *CLEARMSG) TargetMsgID() (string, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(options ...Option) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

Close the connection.

func (*Client) Command

func (c *Client) Command() chan<- Command

func (*Client) Connect

func (c *Client) Connect() error

Connect to Twitch chat.

func (*Client) Default

func (c *Client) Default(event Event)

Default handling of events.

func (*Client) Events

func (c *Client) Events() <-chan Event

type Command

type Command func(io.Writer)

Command executes a command to the server. Be wary that there is a potential for race conditions if you access non-thread-safe variables.

func Join

func Join(channels ...string) Command

Join a twitch channel.

func Line

func Line(packet string) Command

Line writes a line to the server.

func Part

func Part(channel string) Command

Part from a twitch channel.

func Pong

func Pong() Command

Pong is a reply to PING.

func Say

func Say(channel, message string) Command

Say something in a channel.

type Env

type Env interface {
	Command() chan<- Command
	Events() <-chan Event
}

type Event

type Event interface{}

type HOSTTARGET

type HOSTTARGET Packet // Channel starts or stops host mode.

func (*HOSTTARGET) Channel

func (p *HOSTTARGET) Channel() string

func (*HOSTTARGET) HostingChannel

func (p *HOSTTARGET) HostingChannel() string

func (*HOSTTARGET) NumViewers

func (p *HOSTTARGET) NumViewers() (int, error)

type Mux

type Mux struct {
	// contains filtered or unexported fields
}

func (*Mux) Command

func (m *Mux) Command() chan<- Command

func (*Mux) Events

func (m *Mux) Events() <-chan Event

type NOTICE

type NOTICE Packet // General notices from the server.

func (*NOTICE) Channel

func (p *NOTICE) Channel() string

func (*NOTICE) Message

func (p *NOTICE) Message() string

func (*NOTICE) MsgID

func (p *NOTICE) MsgID() (string, error)

type Option

type Option func(*Client)

func Auth

func Auth(nick, pass string) Option

func Cap

func Cap(caps ...string) Option

type PING

type PING Packet

type PRIVMSG

type PRIVMSG Packet

func (*PRIVMSG) Author

func (p *PRIVMSG) Author() string

func (*PRIVMSG) Channel

func (p *PRIVMSG) Channel() string

func (*PRIVMSG) Message

func (p *PRIVMSG) Message() string

type Packet

type Packet struct {
	Tags   map[string]string
	Prefix struct {
		Nick, User, Host string
	}
	Command string
	Params  []string
}

type Prefixer

type Prefixer struct {
	// contains filtered or unexported fields
}

func NewPrefixer

func NewPrefixer(writer io.Writer, prefixFunc func() string) *Prefixer

New creates a new Prefixer that forwards all calls to Write() to writer.Write() with all lines prefixed with the return value of prefixFunc. Having a function instead of a static prefix allows to print timestamps or other changing information.

func (*Prefixer) Write

func (pf *Prefixer) Write(payload []byte) (int, error)

type RECONNECT

type RECONNECT Packet // Rejoin channels after a restart.

type ROOMSTATE

type ROOMSTATE Packet // Identifies the channel’s chat settings (e.g., slow mode duration).

func (*ROOMSTATE) Channel

func (p *ROOMSTATE) Channel() string

type UNKNOWN

type UNKNOWN Packet

type USERNOTICE

type USERNOTICE Packet // Announces Twitch-specific events to the channel (e.g., a user’s subscription notification).

func (*USERNOTICE) Channel

func (p *USERNOTICE) Channel() string

func (*USERNOTICE) Message

func (p *USERNOTICE) Message() string

type USERSTATE

type USERSTATE Packet // Identifies a user’s chat settings or properties (e.g., chat color).

func (*USERSTATE) Channel

func (p *USERSTATE) Channel() string

type WHISPER

type WHISPER Packet

Directories

Path Synopsis
examples
cbt

Jump to

Keyboard shortcuts

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