# :title: rbot config management from IRC
#
# Author:: Giuseppe "Oblomov" Bilotta <giuseppe.bilotta@gmail.com>
-# Copyright:: (C) 2006,2007 Giuseppe Bilotta
-# License:: GPL v2
class ConfigModule < CoreBotModule
def version_string
if $version_timestamp.to_i > 0
- ago = String.new ' ['
- ago << Utils.secs_to_string(Time.now.to_i - $version_timestamp.to_i)
- ago << ' ago]'
+ ago = _(" [%{secs} ago]") % {
+ :secs => Utils.secs_to_string(Time.now.to_i - $version_timestamp.to_i)
+ }
else
ago = ''
end
rx = Regexp.new(params[:rx].to_s, true)
cfs = []
@bot.config.items.each do |k, v|
- cfs << v if k.to_s.match(rx) or (v.desc.match(rx) rescue false)
+ cfs << [Bold + k.to_s + Bold, v.desc] if k.to_s.match(rx) or (v.desc.match(rx) rescue false)
end
if cfs.empty?
m.reply _("no config key found matching %{r}") % { :r => params[:rx].to_s}
else
- m.reply _("possible keys: %{kl}") % { :kl => cfs.map { |c| c.key}.join(', ') }
- m.reply cfs.map { |c| [c.key, c.desc].join(': ') }.join("\n")
+ m.reply _("possible keys: %{kl}") % { :kl => cfs.map { |c| c.first}.join(', ') } if cfs.length > 1
+ m.reply cfs.map { |c| c.join(': ') }.join("\n")
end
end
case m.ctcp.intern
when :VERSION
m.ctcp_reply version_string
- # @bot.irclog "@ #{m.source} asked #{who} about version info"
when :SOURCE
m.ctcp_reply Irc::Bot::SOURCE_URL
- # @bot.irclog "@ #{m.source} asked #{who} about source info"
end
end