# Main bot class, which manages the various components, receives messages,
# handles them or passes them to plugins, and contains core functionality.
class Bot
- COPYRIGHT_NOTICE = "(c) Tom Gilbert and the rbot development team"
+ COPYRIGHT_NOTICE = "(c) Giuseppe Bilotta and the rbot development team"
SOURCE_URL = "http://ruby-rbot.org"
# the bot's Auth data
attr_reader :auth
# loads and opens new registry databases, used by the plugins
attr_accessor :registry_factory
+ attr_accessor :webservice
+
# server we are connected to
# TODO multiserver
def server
},
:desc => "Percentage of IRC penalty to consider when sending messages to prevent being disconnected for excess flood. Set to 0 to disable penalty control.")
Config.register Config::StringValue.new('core.db',
- :default => default_db,
+ :default => default_db, :store_default => true,
:wizard => true,
:validate => Proc.new { |v| Registry::formats.include? v },
:requires_restart => true,
end
@registry_factory = Registry.new @config['core.db']
+ @registry_factory.migrate_registry_folder(path)
@logfile = @config['log.file']
if @logfile.class!=String || @logfile.empty?
end
end
- # call the save method for all of the botmodules
- def save
+ # call the save method for all or the specified botmodule
+ #
+ # :botmodule ::
+ # optional botmodule to save
+ def save(botmodule=nil)
@save_mutex.synchronize do
- @plugins.save
+ @plugins.save(botmodule)
end
end
- # call the rescan method for all of the botmodules
- def rescan
+ # call the rescan method for all or just the specified botmodule
+ #
+ # :botmodule ::
+ # instance of the botmodule to rescan
+ def rescan(botmodule=nil)
debug "\tstopping timer..."
@timer.stop
@save_mutex.synchronize do
- @lang.rescan
- @plugins.rescan
+ # @lang.rescan
+ @plugins.rescan(botmodule)
end
@timer.start
end