Documentation ¶
Index ¶
- Variables
- type Bot
- type Channel
- func (channel *Channel) ChangeMode(mongoConn *mongo.Connection, newMode ChannelMode) (err error)
- func (channel *Channel) MessageLengthMax() int
- func (channel *Channel) Send(message string)
- func (channel *Channel) Sendf(format string, a ...interface{})
- func (channel *Channel) StartMessageQueue(twitchIRC *twitch.Client)
- func (channel *Channel) String() string
- type ChannelMode
- type Command
- type CommandController
- type PajbotAPI
- type PajbotAPIMode
- type QueueMessage
- type Self
- type SubEventMOTD
- type SubEventMessage
- type SubEventSubscription
- type SubEventType
Constants ¶
This section is empty.
Variables ¶
var SubEventDescriptions = []string{
"game changes",
"title changes",
"streamer goes live",
"streamer goes offline",
}
SubEventDescriptions slice with all currently supported events, indexed by the values of SubEventType allowing to cast the index of a string in the slice to a corresponding SubEventType value
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { ID string `bson:"id"` Login string `bson:"login"` DisabledCommands []string `bson:"disabled_commands"` Events map[SubEventType]string `bson:"events"` PajbotAPI *PajbotAPI `bson:"pajbot_api"` MessageLengthLimit int `bson:"message_length_limit"` WhisperCommands bool `bson:"whisper_commands"` EventsOnlyOffline bool `bson:"events_only_offline"` Mode ChannelMode `bson:"mode"` CurrentTitle string `bson:"-"` CurrentGame string `bson:"-"` IsLive bool `bson:"-"` LastMsg string `bson:"-"` QueueChannel chan *QueueMessage `bson:"-"` }
func (*Channel) ChangeMode ¶
func (channel *Channel) ChangeMode(mongoConn *mongo.Connection, newMode ChannelMode) (err error)
func (*Channel) MessageLengthMax ¶
func (*Channel) Sendf ¶
Sendf formats according to a format specifier and runs channel.Send with the resulting string
func (*Channel) StartMessageQueue ¶
func (channel *Channel) StartMessageQueue(twitchIRC *twitch.Client)
type ChannelMode ¶
type ChannelMode int
ChannelMode indicates the bot's state in a Channel
const ( // ChannelModeNormal default ChannelMode with regular ratelimits ChannelModeNormal ChannelMode = iota // ChannelModeInactive bot has been disabled in that chat ChannelModeInactive // ChannelModeModerator bot has elevated ratelimits with moderation permissions ChannelModeModerator // ChannelModeEnumBoundary marks the end of enumeration ChannelModeEnumBoundary )
func (ChannelMode) MessageRatelimit ¶
func (mode ChannelMode) MessageRatelimit() time.Duration
MessageRatelimit the minimum time.Duration that must pass between sending messages in the Channel
type Command ¶
type Command struct { Name string Aliases []string Description string Usage string Run func(msg twitch.PrivateMessage, args []string) CooldownChannel time.Duration CooldownUser time.Duration // TODO: Perhaps cooldown logic should be stored in Bot / redis (?) LastExecutionChannel map[string]time.Time LastExecutionUser map[string]time.Time }
type CommandController ¶
type CommandController struct { Commands map[string]*Command Prefix string // contains filtered or unexported fields }
func NewCommandController ¶
func NewCommandController(prefix string) *CommandController
func (*CommandController) GetCommand ¶
func (c *CommandController) GetCommand(alias string) (*Command, bool)
func (*CommandController) RegisterCommand ¶
func (c *CommandController) RegisterCommand(cmd *Command)
type PajbotAPI ¶
type PajbotAPI struct { Mode PajbotAPIMode `bson:"mode"` Domain string `bson:"domain"` }
type PajbotAPIMode ¶
type PajbotAPIMode int
PajbotAPIMode indicates bot's behavior regarding banphrase checks in channels that have pajbot API configured
const ( // PajbotAPIModeDisabled even if the Domain link is set, API will be totally ignored PajbotAPIModeDisabled PajbotAPIMode = iota // PajbotAPIModeEnabled will attempt to sanitize potentially harmful message content PajbotAPIModeEnabled )
type QueueMessage ¶
type QueueMessage struct {
Message string
}
type SubEventMOTD ¶
SubEventMOTD if present for a channel with the corresponding ChannelID, should be posted right after announcing channel going live It could be useful to remind streamer to tweet or announce going live on Discord
type SubEventMessage ¶
type SubEventMessage struct { Bot *Bot ChannelID string Type SubEventType }
type SubEventSubscription ¶
type SubEventSubscription struct { UserLogin string `bson:"user_login"` UserID string `bson:"user_id"` Event SubEventType `bson:"event"` Value string `bson:"value"` }
type SubEventType ¶
type SubEventType int
SubEventType defines event to which users can subscribe
const ( // SubEventTypeGame game (category) has been updated // Received in EventSub's "channel.update" SubEventTypeGame SubEventType = iota // SubEventTypeTitle title has been updated // Received in EventSub's "channel.update" SubEventTypeTitle // SubEventTypeLive channel has gone live // Received in EventSub's "stream.online" SubEventTypeLive // EventLive channel has gone offline // Received in EventSub's "stream.offline" SubEventTypeOffline // SubEventTypePartnered broadcaster has become partnered // This is deprecated and is kept in case legacy subscriptions with this value are found SubEventTypePartnered // SubEventTypeInvalid represents an invalid event type that was passed to ParseChannelEvent SubEventTypeInvalid )
func ParseSubEventType ¶
func ParseSubEventType(value string) (valid bool, event SubEventType)
ParseSubEventType attempts to convert value to a ChannelEvent event
func (SubEventType) String ¶
func (e SubEventType) String() string