twitchclient

package
v0.0.0-...-3fb79b3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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 handling communication with twitch.

func New

func New(auth *TwitchAuthentication, opts ...Option) *Client

New creates a new TwitchClient with default parameters applying the given options.

func (*Client) Connect

func (client *Client) Connect(in <-chan *gbc.PlatformMessage) (<-chan *gbc.PlatformMessage, error)

Connect establishes an connection to twitch. Messages sent to the `in` channel are sent to twitch after messaging limits are applied. Returns a channel emitting messages received from twitch.

func (*Client) Disconnect

func (client *Client) Disconnect()

Disconnect closes the connection to twitch.

type Message

type Message gbc.PlatformMessage

Message sent from/to twitch.

func (Message) IsWhisper

func (mess Message) IsWhisper() bool

IsWhisper returns if the message represents a whisper message.

func (Message) Receipt

func (mess Message) Receipt() string

Receipt extracts the first parameter of a whisper or privmsg as that represents the user/channel the message is extracted to.

type Option

type Option func(client *Client)

Option to be applied to a client. Options are used for a good maintainable and fluid construction of twitch clients.

func As

func As(mode modes.MessageRateMode) Option

As sets the messaging rate mode.

func Server

func Server(url *url.URL) Option

Server to use to connect to twitch.

func SetAuth

func SetAuth(auth *TwitchAuthentication) Option

SetAuth sets the Authentication used to connect to twitch.

func SetChannels

func SetChannels(channel string, additionals ...string) Option

SetChannels sets the channels to which the client should receive messages from.

func WithChannels

func WithChannels(channels ...string) Option

WithChannels adds channels to the one noted in other options and the default ones.

func WithCommands

func WithCommands() Option

WithCommands enables the client to request that the messages from twitch should contain commands.

func WithMembership

func WithMembership() Option

WithMembership enables the client to request that the messages from twitch should contain membership information.

func WithTags

func WithTags() Option

WithTags enables the client to request that the messages from twitch should contain information in tags.

type TwitchAuthentication

type TwitchAuthentication struct {
	// Username of the twitch account to login with.
	Username string
	// Token contains the OAuth token which can be obtained through https://twitchapps.com/tmi/.
	Token string
}

TwitchAuthentication contains authentication information for twitch.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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