Documentation
¶
Index ¶
- Constants
- type Action
- type Bot
- func (b *Bot) AddPoints(channel pkg.Channel, userID string, points uint64) (bool, uint64)
- func (b *Bot) Application() pkg.Application
- func (b *Bot) AuthenticatedUser() pkg.User
- func (b *Bot) Ban(channel pkg.Channel, user pkg.User, reason string)
- func (b *Bot) BulkEdit(channel string, userIDs []string, points int32)
- func (b *Bot) ChannelIDs() (channelIDs []string)
- func (b *Bot) ConnectToPointServer() (err error)
- func (b *Bot) Connected() bool
- func (b *Bot) Connection() pkg.PubSubConnection
- func (b *Bot) DeleteMessage(channel pkg.Channel, message string)
- func (b *Bot) Disconnect()
- func (b *Bot) FetchDatabaseID() int
- func (b *Bot) ForceRemovePoints(channel pkg.Channel, userID string, points uint64) uint64
- func (b *Bot) GetAccessToken() (string, error)
- func (b *Bot) GetBotChannel(channelName string) pkg.BotChannel
- func (b *Bot) GetBotChannelByID(channelID string) pkg.BotChannel
- func (b *Bot) GetPoints(channel pkg.Channel, userID string) uint64
- func (b *Bot) GetTokenSource() oauth2.TokenSource
- func (b *Bot) GetUserContext() pkg.UserContext
- func (b *Bot) GetUserStore() pkg.UserStore
- func (b *Bot) HandleClearChatMessage(message *twitch.ClearChatMessage)
- func (b *Bot) HandleMessage(channelName string, user twitch.User, rawMessage *twitch.PrivateMessage)
- func (b *Bot) HandleRoomstateMessage(message twitch.RoomStateMessage)
- func (b *Bot) HandleWhisper(message twitch.WhisperMessage)
- func (b *Bot) HelixClient() *apirequest.HelixWrapper
- func (b *Bot) InChannel(channelID string) bool
- func (b *Bot) InChannelName(channelName string) bool
- func (b *Bot) IsApplication() bool
- func (b *Bot) Join(channelName string)
- func (b *Bot) JoinChannel(channelID string) error
- func (b *Bot) JoinChannels()
- func (b *Bot) LeaveChannel(channelID string) error
- func (b *Bot) LoadChannels(sql *sql.DB) error
- func (b *Bot) MakeChannel(channelName string) pkg.Channel
- func (b *Bot) MakeUser(username string) pkg.User
- func (b *Bot) Mention(channel pkg.Channel, user pkg.User, message string)
- func (b *Bot) MessageReceived(source pkg.PubSubSource, topic string, data []byte) error
- func (b *Bot) OnNewChannelJoined(cb func(channel pkg.Channel))
- func (b *Bot) PointRank(channel pkg.Channel, userID string) uint64
- func (b *Bot) Quit(message string)
- func (b *Bot) RefreshToken() error
- func (b *Bot) RemovePoints(channel pkg.Channel, userID string, points uint64) (bool, uint64)
- func (b *Bot) Reply(channel pkg.Channel, user pkg.User, message string)
- func (b *Bot) Say(channel pkg.Channel, message string)
- func (b *Bot) StartChatterPoller()
- func (b *Bot) Timeout(channel pkg.Channel, user pkg.User, duration int, reason string)
- func (b *Bot) TwitchAccount() pkg.TwitchAccount
- func (b *Bot) Unban(channel pkg.Channel, user pkg.User)
- func (b *Bot) Untimeout(channel pkg.Channel, user pkg.User)
- func (b *Bot) UpdateChatSettings(channel pkg.Channel, params *helix.UpdateChatSettingsParams)
- func (b *Bot) Whisper(user pkg.User, message string)
- func (b *Bot) Whisperf(user pkg.User, format string, a ...interface{})
- type BotChannel
- func (c *BotChannel) Ban(user pkg.User, reason string)
- func (c *BotChannel) Bot() pkg.Sender
- func (c *BotChannel) Channel() pkg.Channel
- func (c *BotChannel) ChannelID() string
- func (c *BotChannel) ChannelName() string
- func (c *BotChannel) DatabaseID() int64
- func (c *BotChannel) DeleteMessage(message string)
- func (c *BotChannel) DisableModule(moduleID string) error
- func (c *BotChannel) EnableModule(moduleID string) error
- func (c *BotChannel) Events() *eventemitter.EventEmitter
- func (c *BotChannel) GetID() string
- func (c *BotChannel) GetModule(moduleID string) (pkg.Module, error)
- func (c *BotChannel) GetName() string
- func (c *BotChannel) HandleEventSubNotification(notification pkg.TwitchEventSubNotification) error
- func (c *BotChannel) HandleMessage(user pkg.User, message pkg.Message) error
- func (c *BotChannel) Initialize(b *Bot) error
- func (c *BotChannel) Mention(user pkg.User, message string)
- func (c *BotChannel) OnModules(cb func(module pkg.Module) pkg.Actions, stop bool) (actions []pkg.Actions)
- func (c *BotChannel) Say(message string)
- func (c *BotChannel) SetEmoteOnly(state bool) error
- func (c *BotChannel) SetFollowerMode(state bool, durationM int) error
- func (c *BotChannel) SetNonModChatDelay(state bool, durationS int) error
- func (c *BotChannel) SetSlowMode(state bool, durationS int) error
- func (c *BotChannel) SetSubscribers(state bool) error
- func (c *BotChannel) SetUniqueChat(state bool) error
- func (c *BotChannel) Stream() pkg.Stream
- func (c *BotChannel) Timeout(user pkg.User, duration int, reason string)
- func (c *BotChannel) Unban(user pkg.User)
- func (c *BotChannel) Untimeout(user pkg.User)
- type BotCredentials
- type ModeState
- type PointServer
- type SimpleAccount
- type Stream
- type StreamStatus
- type TwitchAccount
- type TwitchMessage
- type User
Constants ¶
const ( ModeUnset = iota ModeEnabled ModeDisabled )
const ( CommandConnect = 0x01 CommandGetPoints = 0x02 CommandBulkEdit = 0x03 CommandAdd = 0x04 CommandRemove = 0x05 CommandRank = 0x06 )
const DELIMETER_BYTE = ';'
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct { *twitch.Client DatabaseID int QuitChannel chan string Flags botFlags IsConnected bool // contains filtered or unexported fields }
Bot is a wrapper around go-twitch-irc's twitch.Client with a few extra features
func NewBot ¶
func NewBot(databaseID int, twitchAccount pkg.TwitchAccount, tokenSource oauth2.TokenSource, token *oauth2.Token, helixClient *apirequest.HelixWrapper, app pkg.Application) (*Bot, error)
func (*Bot) Application ¶
func (b *Bot) Application() pkg.Application
func (*Bot) AuthenticatedUser ¶
func (*Bot) ChannelIDs ¶
func (*Bot) ConnectToPointServer ¶
func (*Bot) Connection ¶
func (b *Bot) Connection() pkg.PubSubConnection
func (*Bot) Disconnect ¶
func (b *Bot) Disconnect()
Disconnect function should only ever be used for development purposes
func (*Bot) FetchDatabaseID ¶
func (*Bot) ForceRemovePoints ¶
func (*Bot) GetAccessToken ¶
func (*Bot) GetBotChannel ¶
func (b *Bot) GetBotChannel(channelName string) pkg.BotChannel
func (*Bot) GetBotChannelByID ¶
func (b *Bot) GetBotChannelByID(channelID string) pkg.BotChannel
func (*Bot) GetTokenSource ¶
func (b *Bot) GetTokenSource() oauth2.TokenSource
func (*Bot) GetUserContext ¶
func (b *Bot) GetUserContext() pkg.UserContext
func (*Bot) GetUserStore ¶
func (*Bot) HandleClearChatMessage ¶
func (b *Bot) HandleClearChatMessage(message *twitch.ClearChatMessage)
func (*Bot) HandleMessage ¶
func (*Bot) HandleRoomstateMessage ¶
func (b *Bot) HandleRoomstateMessage(message twitch.RoomStateMessage)
func (*Bot) HandleWhisper ¶
func (b *Bot) HandleWhisper(message twitch.WhisperMessage)
func (*Bot) HelixClient ¶
func (b *Bot) HelixClient() *apirequest.HelixWrapper
func (*Bot) InChannelName ¶
func (*Bot) IsApplication ¶
func (*Bot) JoinChannel ¶
func (*Bot) JoinChannels ¶
func (b *Bot) JoinChannels()
func (*Bot) LeaveChannel ¶
func (*Bot) MessageReceived ¶
func (*Bot) OnNewChannelJoined ¶
func (*Bot) RefreshToken ¶
func (*Bot) RemovePoints ¶
func (*Bot) Reply ¶
Reply will reply to the message in the same way it received the message If the message was received in a twitch channel, reply in that twitch channel. IF the message was received in a twitch whisper, reply using twitch whispers.
func (*Bot) StartChatterPoller ¶
func (b *Bot) StartChatterPoller()
func (*Bot) Timeout ¶
Timeout will time a user out two times with a delay inbetween to ensure no sneaky messages come through
func (*Bot) TwitchAccount ¶
func (b *Bot) TwitchAccount() pkg.TwitchAccount
func (*Bot) UpdateChatSettings ¶
type BotChannel ¶
BotChannel describes a bot account that's connected to a channel
func (*BotChannel) Bot ¶
func (c *BotChannel) Bot() pkg.Sender
func (*BotChannel) Channel ¶
func (c *BotChannel) Channel() pkg.Channel
func (*BotChannel) ChannelID ¶
func (c *BotChannel) ChannelID() string
func (*BotChannel) ChannelName ¶
func (c *BotChannel) ChannelName() string
func (*BotChannel) DatabaseID ¶
func (c *BotChannel) DatabaseID() int64
func (*BotChannel) DeleteMessage ¶
func (c *BotChannel) DeleteMessage(message string)
func (*BotChannel) DisableModule ¶
func (c *BotChannel) DisableModule(moduleID string) error
DisableModule disables a module with the given id Returns an error if the module is already disabled We assume that modulesMutex is locked already
func (*BotChannel) EnableModule ¶
func (c *BotChannel) EnableModule(moduleID string) error
EnableModule enables a module with the given id Returns an error if the module is not registered Returns an error if the module is already enabled We assume that modulesMutex is locked already
func (*BotChannel) Events ¶
func (c *BotChannel) Events() *eventemitter.EventEmitter
func (*BotChannel) GetID ¶
func (c *BotChannel) GetID() string
func (*BotChannel) GetName ¶
func (c *BotChannel) GetName() string
func (*BotChannel) HandleEventSubNotification ¶
func (c *BotChannel) HandleEventSubNotification(notification pkg.TwitchEventSubNotification) error
func (*BotChannel) HandleMessage ¶
func (*BotChannel) Initialize ¶
func (c *BotChannel) Initialize(b *Bot) error
func (*BotChannel) Say ¶
func (c *BotChannel) Say(message string)
func (*BotChannel) SetEmoteOnly ¶
func (c *BotChannel) SetEmoteOnly(state bool) error
func (*BotChannel) SetFollowerMode ¶
func (c *BotChannel) SetFollowerMode(state bool, durationM int) error
func (*BotChannel) SetNonModChatDelay ¶
func (c *BotChannel) SetNonModChatDelay(state bool, durationS int) error
func (*BotChannel) SetSlowMode ¶
func (c *BotChannel) SetSlowMode(state bool, durationS int) error
func (*BotChannel) SetSubscribers ¶
func (c *BotChannel) SetSubscribers(state bool) error
func (*BotChannel) SetUniqueChat ¶
func (c *BotChannel) SetUniqueChat(state bool) error
func (*BotChannel) Stream ¶
func (c *BotChannel) Stream() pkg.Stream
func (*BotChannel) Timeout ¶
func (c *BotChannel) Timeout(user pkg.User, duration int, reason string)
func (*BotChannel) Unban ¶
func (c *BotChannel) Unban(user pkg.User)
func (*BotChannel) Untimeout ¶
func (c *BotChannel) Untimeout(user pkg.User)
type BotCredentials ¶
type PointServer ¶
type PointServer struct { ReconnectChannel chan (bool) // contains filtered or unexported fields }
func (*PointServer) Read ¶
func (p *PointServer) Read(size int) []byte
func (*PointServer) Write ¶
func (p *PointServer) Write(payload []byte) bool
type SimpleAccount ¶
type SimpleAccount struct {
// contains filtered or unexported fields
}
func (*SimpleAccount) ID ¶
func (a *SimpleAccount) ID() string
func (*SimpleAccount) Name ¶
func (a *SimpleAccount) Name() string
type Stream ¶
type Stream struct { ID string // contains filtered or unexported fields }
func NewTwitchStream ¶
func (*Stream) NeedsInitialPoll ¶
func (*Stream) Status ¶
func (s *Stream) Status() pkg.StreamStatus
type StreamStatus ¶
type StreamStatus struct { *helix.Stream // contains filtered or unexported fields }
func (*StreamStatus) Live ¶
func (s *StreamStatus) Live() bool
func (*StreamStatus) StartedAt ¶
func (s *StreamStatus) StartedAt() (r time.Time)
func (*StreamStatus) Update ¶
func (s *StreamStatus) Update(streamData *helix.Stream)
type TwitchAccount ¶
func (*TwitchAccount) ID ¶
func (a *TwitchAccount) ID() string
func (*TwitchAccount) Name ¶
func (a *TwitchAccount) Name() string
type TwitchMessage ¶
type TwitchMessage struct {
// contains filtered or unexported fields
}
TwitchMessage is a wrapper for twitch.Message with some extra stuff
func NewTwitchMessage ¶
func NewTwitchMessage(message twitch.Message) *TwitchMessage
func (*TwitchMessage) AddBTTVEmote ¶
func (m *TwitchMessage) AddBTTVEmote(emote pkg.Emote)
func (*TwitchMessage) GetBTTVReader ¶
func (m *TwitchMessage) GetBTTVReader() pkg.EmoteReader
func (TwitchMessage) GetText ¶
func (m TwitchMessage) GetText() string
func (*TwitchMessage) GetTwitchReader ¶
func (m *TwitchMessage) GetTwitchReader() pkg.EmoteReader
func (*TwitchMessage) SetText ¶
func (m *TwitchMessage) SetText(newText string)