Class IRCBot
In: lib/net/yail/IRCBot.rb
Parent: Object

My abstraction from adapter to a real bot.

Methods

Attributes

irc  [R] 

Public Class methods

Creates a new bot yay. Note that due to my laziness, the options here are almost exactly the same as those in Net::YAIL. But at least there are more defaults here.

Options:

  • :irc_network: Name/IP of the IRC server
  • :channels: Channels to automatically join on connect
  • :port: Port number, defaults to 6667
  • :username: Username reported to server
  • :realname: Real name reported to server
  • :nicknames: Array of nicknames to cycle through
  • :silent: Silence a lot of reports
  • :loud: Lots more verbose reports

Public Instance methods

To be subclassed - this method is a nice central location to allow the bot to register its handlers before this class takes control and hits the IRC network.

Creates the socket connection and registers the (very simple) default welcome handler. Subclasses should build their hooks in add_custom_handlers to allow auto-creation in case of a restart.

Returns a string representing uptime

Tells us the main app wants to just wait until we‘re done with all thread processing, or get a kill signal, or whatever. For now this is basically an endless loop that lets the threads do their thing until the socket dies. If a bot wants, it can handle :irc_loop to do regular processing.

Enters the socket‘s listening loop(s)

[Validate]