Documentation ¶
Index ¶
- type ActionFunc
- type Actioner
- type IrcBot
- func (b *IrcBot) AddInternAction(a Actioner)
- func (b *IrcBot) AddUserAction(a Actioner)
- func (b *IrcBot) Connect(password string) error
- func (b *IrcBot) DBConnection() (*db.DB, error)
- func (b *IrcBot) Disconnect()
- func (b *IrcBot) GetActioner(actionName string) (Actioner, error)
- func (b *IrcBot) GetActionnersCmds() []string
- func (b *IrcBot) Say(channel string, text string)
- func (b *IrcBot) String() string
- type IrcMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionFunc ¶
ActionFunc is the type of function used in Actioner
type Actioner ¶
type Actioner interface { // array of IRC or user command on which the action will be triggered (MSG) // example for IRC command: JOIN, PRIVMSG // example for user command: .myCmd Command() []string // used to display help about the action Usage() string // actual action done by the bot Do(b *IrcBot, m *IrcMsg) }
Actioner is the interface that objects need to implement custom action for the bot
type IrcBot ¶
type IrcBot struct { // identity User string Nick string //channel to send *IrcMsg to the goroutine that handle input message //You usualy don't need to send anything there. It's useful when creating custom actionner ChIn chan *IrcMsg //channel to send *IrcMsg to the goroutine that handle output message //every *IrcMsg send in this channel will be send to the server //You usualy don't need to send anything there. It's useful when creating custom actionner ChOut chan *IrcMsg //channel to send *IrcMsg to the goroutine that handle errors ChError chan error // exit flag Exit chan bool // contains filtered or unexported fields }
IrcBot represents the bot in general
func (*IrcBot) AddInternAction ¶
AddInternAction add an action to excecute on internal command (join,connect,...) command is the internal command to handle, action is an ActionFunc callback
func (*IrcBot) AddUserAction ¶
AddUserAction add an action fired by the user to handle command is the commands send by user, action is an ActionFunc callback
func (*IrcBot) DBConnection ¶
DBConnection return a new connection do the database. Use it if your custom action need to access the database
func (*IrcBot) Disconnect ¶
func (b *IrcBot) Disconnect()
Disconnect sends QUIT command to server and closes connections
func (*IrcBot) GetActioner ¶
GetActionUsage returns the Actioner from the user actions map or return an error if no action if found with this name Usefull if you want to access actioner information within other actioner see Help actionner for example
func (*IrcBot) GetActionnersCmds ¶
GetActionnersCmds returns all registred user actioners commands