Documentation
¶
Index ¶
- Constants
- Variables
- func TimeStamp() string
- func TimeStampFmt(format string) string
- type AppOAuthCred
- type IRCOAuthCred
- type KardBot
- func (bb *KardBot) ActiveChannels() int
- func (bb *KardBot) Connect()
- func (bb *KardBot) Disconnect()
- func (bb *KardBot) HandleChat() error
- func (bb *KardBot) JoinChannel(channels ...string)
- func (bb *KardBot) LeaveChannel(channels ...string)
- func (bb *KardBot) Login()
- func (bb *KardBot) Msg(msg string, users ...string) error
- func (bb *KardBot) ReadCredentials(credType string) error
- func (bb *KardBot) Say(msg string, channels ...string) error
- func (bb *KardBot) Start()
Constants ¶
const UTCFormat = "Jan 2 15:04:05 UTC"
Variables ¶
var CmdRegex *regexp.Regexp = regexp.MustCompile(`^!(\w+)\s?(\w+)?`)
Regex for parsing user commands, from already parsed PRIVMSG strings.
First matched group is the command name and the second matched group is the argument for the command.
var ConnectRegex *regexp.Regexp = regexp.MustCompile(`^:tmi.twitch.tv 001 ([^ ]+) .*`)
Regex for parsing connection messages
First matched group is our real username - twitch doesn't complain at using NICK command but doesn't honor it.
var DirectMsgRegex *regexp.Regexp = regexp.MustCompile(`^:(\w+)!\w+@\w+\.tmi\.twitch\.tv (PRIVMSG) (\w+)(?: :(.*))?$`)
var MsgRegex *regexp.Regexp = regexp.MustCompile(`^:(\w+)!\w+@\w+\.tmi\.twitch\.tv (PRIVMSG) #(\w+)(?: :(.*))?$`)
Regex for parsing PRIVMSG strings.
First matched group is the user's name, second is the channel? and the third matched group is the content of the user's message.
Functions ¶
func TimeStampFmt ¶
Types ¶
type AppOAuthCred ¶
type IRCOAuthCred ¶
type KardBot ¶
type KardBot struct { Channel string IrcCredentials *IRCOAuthCred AppCredentials *AppOAuthCred MsgRate time.Duration Name string Port string IrcPrivatePath string AppPrivatePath string Server string Prompts []string GlobalData data.GlobalData // contains filtered or unexported fields }
func (*KardBot) ActiveChannels ¶
Look at the channels I'm actually in
func (*KardBot) Connect ¶
func (bb *KardBot) Connect()
Connects the bot to the Twitch IRC server. The bot will continue to try to connect until it succeeds or is forcefully shutdown.
func (*KardBot) Disconnect ¶
func (bb *KardBot) Disconnect()
Officially disconnects the bot from the Twitch IRC server.
func (*KardBot) HandleChat ¶
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 (*KardBot) JoinChannel ¶
Makes the bot join its pre-specified channel.
func (*KardBot) LeaveChannel ¶
func (*KardBot) ReadCredentials ¶
Reads from the private credentials file and stores the data in the bot's appropriate Credentials field.