summaryrefslogtreecommitdiff
path: root/lib/rbot/ircbot.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbot/ircbot.rb')
-rw-r--r--lib/rbot/ircbot.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 02414a07..34c82926 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -435,8 +435,8 @@ class Bot
},
: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 => "dbm",
- :wizard => true, :default => "dbm",
+ :default => default_db,
+ :wizard => true,
:validate => Proc.new { |v| Registry::formats.include? v },
:requires_restart => true,
:desc => "DB adaptor to use for storing the plugin data/registries. Options: " + Registry::formats.join(', '))
@@ -822,6 +822,16 @@ class Bot
end
end
+ # Determine if tokyocabinet is installed, if it is use it as a default.
+ def default_db
+ begin
+ require 'tokyocabinet'
+ return 'tc'
+ rescue LoadError
+ return 'dbm'
+ end
+ end
+
def repopulate_botclass_directory
template_dir = File.join Config::datadir, 'templates'
if FileTest.directory? @botclass