Class: Irc::Plugin

Class Irc::Plugin |
In: | rbot/plugins.rb
Parent: | Object

base class for all rbot plugins certain methods will be called if they are provided, if you define one of the following methods, it will be called as appropriate:

listen(UserMessage): | Called for all NOTICE and PRIVMSG messages. To differentiate them, use message.kind_of? It'll be either a PrivMessage or a NoticeMessage
privmsg(PrivMessage): | called for a PRIVMSG if the first word matches one the plugin register()d for. Use m.plugin to get that word and m.params for the rest of the message, if applicable.
kick(KickMessage): | Called when a user (or the bot) is kicked from a channel the bot is in.
join(JoinMessage): | Called when a user (or the bot) joins a channel
part(PartMessage): | Called when a user (or the bot) parts a channel
save: | Called when you are required to save your plugin's state, if you maintain data between sessions
cleanup: | called before your plugin is "unloaded", prior to a plugin reload or bot quit - close any open files/connections or flush caches here

Methods

help listen? name new register

Public Class methods

new()

initialise your plugin. Always call super if you override this method, as important variables are set up for you

Public Instance methods

name()

return an identifier for this plugin, defaults to a list of the message prefixes handled (used for error messages etc)

help(plugin, topic)

return a help string for your module. for complex modules, you may wish to break your help into topics, and return a list of available topics if `topic` is nil. `plugin` is passed containing the matching prefix for this message - if your plugin handles multiple prefixes, make sure your return the correct help for the prefix requested

register(name)

register the plugin as a handler for messages prefixed `name` this can be called multiple times for a plugin to handle multiple message prefixes

listen?()

is this plugin listening to all messages?