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(t Trigger)
- 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) 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 (irc *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 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
// This bots nick
Nick 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 given trigger to the bots 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 (irc *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
//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 used to subscribe and react to events on the bot Server