Documentation
¶
Index ¶
- func ReconOpt() func(*Bot)
- func SaslAuth(pass string) func(*Bot)
- type Bot
- func (bot *Bot) Action(who, text string)
- func (bot *Bot) AddTrigger(h Handler)
- func (bot *Bot) ChMode(user, channel, mode string)
- func (bot *Bot) Close() error
- func (bot *Bot) Join(ch string)
- func (bot *Bot) Msg(who, text string)
- func (bot *Bot) Notice(who, text string)
- func (bot *Bot) Part(ch, msg string)
- func (bot *Bot) Reply(m *Message, text string)
- func (bot *Bot) Run()
- func (bot *Bot) SASLAuthenticate(user, pass string)
- func (bot *Bot) Send(command string)
- func (bot *Bot) SetNick(nick string)
- func (bot *Bot) StandardRegistration()
- func (bot *Bot) StartUnixListener()
- func (bot *Bot) String() string
- func (bot *Bot) Topic(c, topic string)
- func (bot *Bot) Uptime() string
- func (bot *Bot) WaitFor(filter func(*Message) bool)
- type Handler
- type Message
- type Trigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bot ¶
type Bot struct {
// Channel for user to read incoming messages
Incoming chan *Message
// Log15 loggger
log.Logger
// Exported fields
Host string
Password string
Channels []string
SSL bool
SASL bool
HijackSession bool
// An optional function that connects to an IRC server over plaintext:
Dial func(network, addr string) (net.Conn, error)
// An optional function that connects to an IRC server over a secured connection:
DialTLS func(network, addr string, tlsConf *tls.Config) (*tls.Conn, error)
// This bots nick
Nick string
// This bots realname
Realname string
// Duration to wait between sending of messages to avoid being
// kicked by the server for flooding (default 200ms)
ThrottleDelay time.Duration
// Maxmimum time between incoming data
PingTimeout time.Duration
TLSConfig tls.Config
// contains filtered or unexported fields
}
Bot implements an irc bot to be connected to a given server
func (*Bot) AddTrigger ¶
AddTrigger adds a trigger to the bot's handlers
func (*Bot) ChMode ¶
ChMode is used to change users modes in a channel operator = "+o" deop = "-o" ban = "+b"
func (*Bot) Run ¶
func (bot *Bot) Run()
Run starts the bot and connects to the server. Blocks until we disconnect from the server.
func (*Bot) SASLAuthenticate ¶
SASLAuthenticate performs SASL authentication ref: https://github.com/atheme/charybdis/blob/master/doc/sasl.txt
func (*Bot) StandardRegistration ¶
func (bot *Bot) StandardRegistration()
StandardRegistration performsa a basic set of registration commands
func (*Bot) StartUnixListener ¶
func (bot *Bot) StartUnixListener()
StartUnixListener starts up a unix domain socket listener for reconnects to be sent through
type Message ¶
type Message struct {
// irc.Message from sorcix
*irc.Message
// Content generally refers to the text of a PRIVMSG
Content string
// Raw contains the _raw message_
Raw string
//Time at which this message was recieved
TimeStamp time.Time
// Entity that this message was addressed to (channel or user)
To string
// Nick of the messages sender (equivalent to Prefix.Name)
// Outdated, please use .Name
From string
}
Message represents a message received from the server
func ParseMessage ¶
ParseMessage takes a string and attempts to create a Message struct. Returns nil if the Message is invalid. TODO: Maybe just use sorbix/irc if we can be without the custom stuff?
type Trigger ¶
type Trigger struct {
// Returns true if this trigger applies to the passed in message
Condition func(*Bot, *Message) bool
// The action to perform if Condition is true
// return true if the message was 'consumed'
Action func(*Bot, *Message) bool
}
Trigger is a Handler which is guarded by a condition
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
main
command
This is an example program showing the usage of hellabot
|
This is an example program showing the usage of hellabot |
|
sample-triggers
command
|
|
|
sasl
command
This is an example program showing the usage of hellabot
|
This is an example program showing the usage of hellabot |
|
commands
module
|
