Documentation
¶
Overview ¶
Package bot provides a simple to use IRC bot
Index ¶
- Variables
- func ConfigureEvents()
- func DeleteUserKey(nick string, key string)
- func GetChannelKey(channel string, key string) bool
- func GetNames(channel string) []string
- func GetUserKey(nick string, key string) string
- func IsAdmin(senderNick string) bool
- func IsIgnored(senderNick string) bool
- func IsPrivateMsg(channel, currentNick string) bool
- func RegisterCommand(command string, cmdFunc activeCmdFunc)
- func RegisterPassiveCommand(command string, cmdFunc func(cmd *PassiveCmd) (string, error))
- func Run(c *Configure)
- func SetChannelKey(channel string, key string, value bool)
- func SetUserKey(nick string, key string, value string)
- type API
- type Cmd
- type Configure
- type PassiveCmd
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Conn *irc.Connection Config *Configure ChannelNicks = make(map[string][]string) )
View Source
var ( KV *gkvlite.Store Users *gkvlite.Collection Channels *gkvlite.Collection )
Functions ¶
func ConfigureEvents ¶
func ConfigureEvents()
func DeleteUserKey ¶
func GetChannelKey ¶
func GetUserKey ¶
func IsPrivateMsg ¶
func RegisterCommand ¶
func RegisterCommand(command string, cmdFunc activeCmdFunc)
func RegisterPassiveCommand ¶
func RegisterPassiveCommand(command string, cmdFunc func(cmd *PassiveCmd) (string, error))
func Run ¶
func Run(c *Configure)
Run reads the Config, connect to the specified IRC server and starts the bot. The bot will automatically join all the channels specified in the Configuration
func SetChannelKey ¶
func SetUserKey ¶
Types ¶
type Cmd ¶
type Cmd struct {
Raw string // Raw is full string passed to the command
Channel string // Channel where the command was called
Nick string // User who sent the message
Message string // Full string without the prefix
Command string // Command is the first argument passed to the bot
FullArg string // Full argument as a single string
Args []string // Arguments as array
}
Cmd holds the parsed user's input for easier handling of commands
type Configure ¶
type Configure struct {
Server string // IRC server:port. Ex: irc.rizon.net:6697
Channel string // Initial channel to connect. Ex: "#channel"
User string // The IRC username the bot will use
Nick string // The nick the bot will use
Nickserv string // Nickserv password
Password string // Server password
Modes string // User modes. Ex: GRp
UseTLS bool // Should connect using TLS? (yes)
TLSServerName string // Must supply if UseTLS is true
Debug bool // This will log all IRC communication to standad output
Prefix string // Prefix used to identify a command. !hello whould be identified as a command
Owner string // Owner of the bot. Used for admin-only commands
API
}
Configure must contain the necessary data to connect to an IRC server
type PassiveCmd ¶
type PassiveCmd struct {
Raw string // Raw message sent to the channel
Channel string // Channel which the message was sent to
Nick string // Nick of the user which sent the message
}
PassiveCmd holds the information which will be passed to passive commands when receiving a message on the channel
Click to show internal directories.
Click to hide internal directories.