Class | Irc::Bot
In: | lib/rbot/botuser.rb lib/rbot/config.rb lib/rbot/ircbot.rb lib/rbot/language.rb lib/rbot/message.rb lib/rbot/messagemapper.rb lib/rbot/plugins.rb lib/rbot/rbotconfig.rb lib/rbot/registry.rb
Parent: | Object

Main bot class, which manages the various components, receives messages, handles them or passes them to plugins, and contains core functionality.

### Methods

action connect ctcp_notice ctcp_say disconnect got_sig help inspect join kick mainloop mode myself new nick nickchg notice okay part ping_server quiet_on? quit rescan reset_quiet restart save say sendmsg sendq server set_default_send_options set_quiet setup_plugins_path shutdown status stop_server_pings topic trap_sigs wanted_nick wanted_nick= whois

### Classes and Modules

Module Irc::Bot::Auth
Module Irc::Bot::Config
Module Irc::Bot::Plugins
Class Irc::Bot::Language
Class Irc::Bot::MessageMapper
Class Irc::Bot::MessageParameter
Class Irc::Bot::MessageTemplate
Class Irc::Bot::Registry

### Constants

COPYRIGHT_NOTICE | = | "(c) Tom Gilbert and the rbot development team"
SOURCE_URL | = | "http://ruby-rbot.org"

### Attributes

auth | [R] | the bot‘s Auth data
botclass | [R] | the botclass for this bot (determines configdir among other things)
config | [R] | the bot‘s Config data
httputil | [RW] | bot‘s httputil help object, for fetching resources via http. Sets up proxies etc as defined by the bot configuration/environment
lang | [R] | bot‘s Language data
plugins | [R] | bot‘s plugins. This is an instance of class Plugins
registry | [R] | bot‘s object registry, plugins get an interface to this for persistant storage (hash interface tied to a bdb file, plugins use Accessors to store and restore objects in their own namespaces.)
save_mutex | [R] | synchronize with this mutex while touching permanent data files: saving, flushing, cleaning up …
socket | [R] | bot‘s irc socket TODO multiserver
timer | [R] | used to perform actions periodically (saves configuration once per minute by default)

### Public Class methods

new(botclass, params = {})

create a new Bot with botclass `botclass`

### Public Instance methods

action(where, message, options={})

perform a CTCP action with message `message` to channel/nick `where`

connect()

connect the bot to IRC

ctcp_notice(where, command, message, options={})
ctcp_say(where, command, message, options={})
disconnect(message=nil)
got_sig(sig, func=:quit)

things to do when we receive a signal

help(topic=nil)

m: | message asking for help
topic: | optional topic help is requested for

respond to online help requests

inspect()

bot inspection TODO multiserver

join(channel, key=nil)

channel: | channel to join
key: | optional channel key if channel is +s

join a channel

kick(channel, user, msg)

kicking a user

mainloop()

begin event handling loop

mode(channel, mode, target=nil)

changing mode

myself()

bot User in the client/server connection TODO multiserver

nick()

bot User in the client/server connection

nickchg(name)

attempt to change bot‘s nick to `name`

notice(where, message, options={})

send a notice message to channel/nick `where`

okay(where)

quick way to say "okay" (or equivalent) to `where`

part(channel, message="")

part a channel

ping_server()

We want to respond to a hung server in a timely manner. If nothing was received in the user-selected timeout and we haven‘t PINGed the server yet, we PING the server. If the PONG is not received within the user-defined timeout, we assume we‘re in ping timeout and act accordingly.

quiet_on?(channel)

checks if we should be quiet on a channel

quit(message=nil)

message: | optional IRC quit message

quit IRC, shutdown the bot

rescan()

call the rescan method for all of the botmodules

reset_quiet(channel = nil)
restart(message=nil)

totally shutdown and respawn the bot

save()

call the save method for all of the botmodules

say(where, message, options={})

say something (PRIVMSG) to channel/nick `where`

sendmsg(type, where, original_message, options={})

type: | message type
where: | message target
message: | message text

send message `message` of type `type` to target `where` Type can be PRIVMSG, NOTICE, etc, but those you should really use the relevant say() or notice() methods. This one should be used for IRCd extensions you want to use in modules.

sendq(message="", chan=nil, ring=0)

queue an arbitraty message for the server

server()

server we are connected to TODO multiserver

set_default_send_options(opts={})
set_quiet(channel = nil)
setup_plugins_path()
shutdown(message=nil)

disconnect from the server and cleanup all plugins and modules

status()

returns a string describing the current status of the bot (uptime etc)

stop_server_pings()
topic(where, topic=nil)

set topic of channel `where` to `topic` can also be used to retrieve the topic of channel `where` by omitting the last argument

trap_sigs()

trap signals

wanted_nick()

nick wanted by the bot. This defaults to the irc.nick config value, but may be overridden by a manual !nick command

wanted_nick=(wn)

set the nick wanted by the bot

whois(nick, target=nil)

asking whois

[Validate]