+ :on_change => Proc.new { |bot, v|
+ if @save_timer
+ if v > 0
+ @timer.reschedule(@save_timer, v)
+ @timer.unblock(@save_timer)
+ else
+ @timer.block(@save_timer)
+ end
+ else
+ if v > 0
+ @save_timer = @timer.add(v) { bot.save }
+ end
+ # Nothing to do when v == 0
+ end
+ },
+ :desc => "How often the bot should persist all configuration to disk (in case of a server crash, for example)")
+
+ BotConfig.register BotConfigBooleanValue.new('core.run_as_daemon',
+ :default => false, :requires_restart => true,
+ :desc => "Should the bot run as a daemon?")
+
+ BotConfig.register BotConfigStringValue.new('log.file',
+ :default => false, :requires_restart => true,
+ :desc => "Name of the logfile to which console messages will be redirected when the bot is run as a daemon")
+ BotConfig.register BotConfigIntegerValue.new('log.level',
+ :default => 1, :requires_restart => false,
+ :validate => Proc.new { |v| (0..5).include?(v) },
+ :on_change => Proc.new { |bot, v|
+ $logger.level = v
+ },
+ :desc => "The minimum logging level (0=DEBUG,1=INFO,2=WARN,3=ERROR,4=FATAL) for console messages")
+ BotConfig.register BotConfigIntegerValue.new('log.keep',
+ :default => 1, :requires_restart => true,
+ :validate => Proc.new { |v| v >= 0 },
+ :desc => "How many old console messages logfiles to keep")
+ BotConfig.register BotConfigIntegerValue.new('log.max_size',
+ :default => 10, :requires_restart => true,
+ :validate => Proc.new { |v| v > 0 },
+ :desc => "Maximum console messages logfile size (in megabytes)")
+
+ BotConfig.register BotConfigArrayValue.new('plugins.path',
+ :wizard => true, :default => ['(default)', '(default)/games', '(default)/contrib'],
+ :requires_restart => false,
+ :on_change => Proc.new { |bot, v| bot.setup_plugins_path },
+ :desc => "Where the bot should look for plugins. List multiple directories using commas to separate. Use '(default)' for default prepackaged plugins collection, '(default)/contrib' for prepackaged unsupported plugins collection")
+
+ BotConfig.register BotConfigEnumValue.new('send.newlines',
+ :values => ['split', 'join'], :default => 'split',
+ :on_change => Proc.new { |bot, v|
+ bot.set_default_send_options :newlines => v.to_sym
+ },
+ :desc => "When set to split, messages with embedded newlines will be sent as separate lines. When set to join, newlines will be replaced by the value of join_with")
+ BotConfig.register BotConfigStringValue.new('send.join_with',
+ :default => ' ',
+ :on_change => Proc.new { |bot, v|
+ bot.set_default_send_options :join_with => v.dup
+ },
+ :desc => "String used to replace newlines when send.newlines is set to join")
+ BotConfig.register BotConfigIntegerValue.new('send.max_lines',
+ :default => 5,
+ :validate => Proc.new { |v| v >= 0 },
+ :on_change => Proc.new { |bot, v|
+ bot.set_default_send_options :max_lines => v
+ },
+ :desc => "Maximum number of IRC lines to send for each message (set to 0 for no limit)")
+ BotConfig.register BotConfigEnumValue.new('send.overlong',
+ :values => ['split', 'truncate'], :default => 'split',
+ :on_change => Proc.new { |bot, v|
+ bot.set_default_send_options :overlong => v.to_sym
+ },
+ :desc => "When set to split, messages which are too long to fit in a single IRC line are split into multiple lines. When set to truncate, long messages are truncated to fit the IRC line length")
+ BotConfig.register BotConfigStringValue.new('send.split_at',
+ :default => '\s+',
+ :on_change => Proc.new { |bot, v|
+ bot.set_default_send_options :split_at => Regexp.new(v)
+ },
+ :desc => "A regular expression that should match the split points for overlong messages (see send.overlong)")
+ BotConfig.register BotConfigBooleanValue.new('send.purge_split',
+ :default => true,
+ :on_change => Proc.new { |bot, v|
+ bot.set_default_send_options :purge_split => v
+ },
+ :desc => "Set to true if the splitting boundary (set in send.split_at) should be removed when splitting overlong messages (see send.overlong)")
+ BotConfig.register BotConfigStringValue.new('send.truncate_text',
+ :default => "#{Reverse}...#{Reverse}",
+ :on_change => Proc.new { |bot, v|
+ bot.set_default_send_options :truncate_text => v.dup
+ },
+ :desc => "When truncating overlong messages (see send.overlong) or when sending too many lines per message (see send.max_lines) replace the end of the last line with this text")