X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fri.rb;h=abecb6ec5a5966b57f52e0dd99593ae4d8715053;hb=052217de30c59206d7025b582d4604557a747470;hp=472c08e3c1d7c77c57fe76cb1ce8cd6b59234fed;hpb=9efe37db63efbe8c2e360fed93382e59bf1b417b;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/ri.rb b/data/rbot/plugins/ri.rb index 472c08e3..abecb6ec 100644 --- a/data/rbot/plugins/ri.rb +++ b/data/rbot/plugins/ri.rb @@ -16,7 +16,7 @@ class RiPlugin < Plugin RI_COMMAND = %w{ri -f simple -T} - BotConfig.register BotConfigIntegerValue.new('ri.max_length', + Config.register Config::IntegerValue.new('ri.max_length', :default => 512, :desc => "Maximum length of ri entry (in bytes) which is ok to be sent to channels or other users") @@ -52,12 +52,15 @@ class RiPlugin < Plugin return m.reply("failed to execute ri") end ret = ret.gsub(/\t/, " ").split(/\n/).join(" ").gsub(/\s\s+/, ' ') - - if ret.length > @bot.config['ri.max_length'] && !m.private? - return m.reply('entry is too long to send to the channel or to some other user, use /msg to ask me about it') + + if ret.length > @bot.config['ri.max_length'] + if !m.private? && tgt.to_s != m.sourcenick + return m.reply('entry is too long to send to the channel or to some other user, use /msg to ask me about it') + end end if tgt @bot.say(tgt, ret) + m.okay else m.reply(ret) end