etc.
privmsg(PrivMessage)::
- called for a PRIVMSG if the first word matches one
+ 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.
+ unreplied(PrivMessage)::
+ Called for a PRIVMSG which has not been replied to.
+
kick(KickMessage)::
Called when a user (or the bot) is kicked from a
channel the bot is in.
connect():: Called when a server is joined successfully, but
before autojoin channels are joined (no params)
+ set_language(String)::
+ Called when the user sets a new language
+ whose name is the given String
+
save:: Called when you are required to save your plugin's
state, if you maintain data between sessions
@registry = BotRegistryAccessor.new(@bot, self.class.to_s.gsub(/^.*::/, ""))
@manager.add_botmodule(self)
+ if self.respond_to?('set_language')
+ self.set_language(@bot.lang.language)
+ end
end
def botmodule_class
attr_reader :botmodules
def initialize
- bot_associate(nil)
-
- @dirs = []
- end
-
- # Reset lists of botmodules
- def reset_botmodule_lists
@botmodules = {
:CoreBotModule => [],
:Plugin => []
}
+
@names_hash = Hash.new
@commandmappers = Hash.new
+
+ @dirs = []
+
+ @failed = Array.new
+ @ignored = Array.new
+
+ bot_associate(nil)
+ end
+
+ # Reset lists of botmodules
+ def reset_botmodule_lists
+ @botmodules[:CoreBotModule].clear
+ @botmodules[:Plugin].clear
+ @names_hash.clear
+ @commandmappers.clear
end
# Associate with bot _bot_
# load plugins from pre-assigned list of directories
def scan
- @failed = Array.new
- @ignored = Array.new
+ @failed.clear
+ @ignored.clear
processed = Hash.new
@bot.config['plugins.blacklist'].each { |p|