twitch_chat_bot

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

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

Go to latest
Published: Jan 20, 2023 License: MIT Imports: 12 Imported by: 0

README

twitch_chat_bot

An app to connect with twitch chat by channel

Documentation

Index

Constants

View Source
const PSTFormat = "Jan 2 15:04:05 PST"

Variables

This section is empty.

Functions

func TimeStamp

func TimeStamp(format string) string

the generic variation, for bots using the TwitchBot interface

Types

type BasicBot

type BasicBot struct {
	Channel string

	Credentials *OAuthCred
	MsgRate     time.Duration
	Name        string
	Port        string
	PrivatePath string
	Server      string
	// contains filtered or unexported fields
}

func (*BasicBot) Connect

func (bb *BasicBot) Connect()

Connects the bot to the Twitch IRC server. The bot will continue to try to connect until it succeeds or is manually shutdown.

func (*BasicBot) Disconnect

func (bb *BasicBot) Disconnect()

Officially disconnects the bot from the Twitch IRC server.

func (*BasicBot) HandleChat

func (bb *BasicBot) HandleChat() error

Listens for and logs messages from chat. Responds to commands from the channel owner. The bot continues until it gets disconnected, told to shutdown, or forcefully shutdown.

func (*BasicBot) JoinChannel

func (bb *BasicBot) JoinChannel()

Makes the bot join its pre-specified channel.

func (*BasicBot) ReadCredentials

func (bb *BasicBot) ReadCredentials() error

Reads from the private credentials file and stores the data in the bot's Credentials field.

func (*BasicBot) Say

func (bb *BasicBot) Say(msg string) error

Makes the bot send a message to the chat channel.

func (*BasicBot) Start

func (bb *BasicBot) Start()

Starts a loop where the bot will attempt to connect to the Twitch IRC server, then connect to the pre-specified channel, and then handle the chat. It will attempt to reconnect until it is told to shut down, or is forcefully shutdown.

type OAuthCred

type OAuthCred struct {
	Password string `json:"password,omitempty"`
}

type TwitchBot

type TwitchBot interface {
	Connect()
	Disconnect()
	HandleChat() error
	JoinChannel()
	ReadCredentials() error
	Say(msg string) error
	Start()
}

Jump to

Keyboard shortcuts

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