twitch

package
v0.0.0-...-de8c04a Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package twitch handles Twitch-specific logic.

Index

Constants

View Source
const (
	// Name is the unique, human-readable name of the platform.
	Name = "Twitch"
)

Variables

View Source
var (
	ErrChannelNotFound = errors.New("channel not found")
	ErrBotIsBanned     = errors.New("bot is banned from the channel")
)

Functions

This section is empty.

Types

type Twitch

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

Twitch implements Platform for a connection to Twitch chat.

func New

func New(username string, owners []string, clientID, clientSecret, accessToken, refreshToken string, db *gorm.DB, cdb cache.Cache) *Twitch

New creates a new Twitch connection.

func NewForTesting

func NewForTesting(t *testing.T, url string, db *gorm.DB) *Twitch

New creates a new Twitch connection for testing.

func (*Twitch) Channel

func (t *Twitch) Channel(channel string) (*helix.ChannelInformation, error)

func (*Twitch) Connect

func (t *Twitch) Connect(ctx context.Context) error

func (*Twitch) CurrentUsers

func (t *Twitch) CurrentUsers() ([]string, error)

func (*Twitch) Disconnect

func (t *Twitch) Disconnect() error

func (*Twitch) FetchUser

func (t *Twitch) FetchUser(channel string) (*helix.User, error)

func (*Twitch) Join

func (t *Twitch) Join(channel string, prefix string) error

func (*Twitch) Leave

func (t *Twitch) Leave(channel string) error

func (*Twitch) Listen

func (t *Twitch) Listen() <-chan base.IncomingMessage

func (*Twitch) Name

func (t *Twitch) Name() string

func (*Twitch) Reply

func (t *Twitch) Reply(msg base.Message, replyToID string) error

func (*Twitch) Send

func (t *Twitch) Send(msg base.Message) error

func (*Twitch) SetPrefix

func (t *Twitch) SetPrefix(channel, prefix string) error

func (*Twitch) Timeout

func (t *Twitch) Timeout(username, channel string, duration time.Duration) error

func (*Twitch) User

func (t *Twitch) User(username string) (models.User, error)

func (*Twitch) Username

func (t *Twitch) Username() string

Jump to

Keyboard shortcuts

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