Class: Irc::IrcBot

Class Irc::IrcBot |
In: | rbot/ircbot.rb
Parent: | Object

Main bot class, which receives messages, handles them or passes them to plugins, and stores runtime data

Methods

action connect corehelp delegate_privmsg help join log log_sent mainloop new nickchg notice okay onjoin onkick onpart onprivmsg part quit rescan save say sendmsg topic

Attributes

:auth | [R] | the bot's IrcAuth data
:botclass | [R] | the botclass for this bot (determines configdir among other things)
:config | [R] | the bot's BotConfig data
:lang | [R] | bot's Language data
:nick | [R] | the bot's current nickname
:timer | [R] | used to perform actions periodically (saves configuration once per minute by default)

Public Class methods

new(botclass)

create a new IrcBot with botclass `botclass`

Public Instance methods

connect()

connect the bot to IRC

mainloop()

begin event handling loop

sendmsg(type, where, message)

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.

notice(where, message)

send a notice message to channel/nick `where`

say(where, message)

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

action(where, message)

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

okay(where)

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

log(message, where="server")

log message `message` to a file determined by `where`. `where` can be a channel name, or a nick for private message logging

topic(where, topic)

set topic of channel `where` to `topic`

quit(message="bye")

message: | optional IRC quit message

quit IRC, shutdown the bot

save()

call the save method for bot's config, keywords, auth and all plugins

rescan()

call the rescan method for the bot's lang, keywords and all plugins

join(channel, key=nil)

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

join a channel

part(channel)

part a channel

nickchg(name)

attempt to change bot's nick to `name`

help(topic=nil)

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

respond to online help requests

Private Instance methods

corehelp(topic="")

handle help requests for "core" topics

onprivmsg(m)

handle incoming IRC PRIVMSG `m`

log_sent(type, where, message)

log a message. Internal use only.

onjoin(m)

onpart(m)

onkick(m)

respond to being kicked from a channel

delegate_privmsg(message)

delegate a privmsg to auth, keyword or plugin handlers