diff options
Diffstat (limited to 'data/rbot/plugins/fish.rb')
-rw-r--r-- | data/rbot/plugins/fish.rb | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/data/rbot/plugins/fish.rb b/data/rbot/plugins/fish.rb index 57aaafc2..68240659 100644 --- a/data/rbot/plugins/fish.rb +++ b/data/rbot/plugins/fish.rb @@ -36,16 +36,22 @@ class BabelPlugin < Plugin "application/x-www-form-urlencoded"}) if (resp.code == "200") + lines = Array.new resp.body.each_line do |l| - if(l =~ /^\s+<td bgcolor=white class=s><div style=padding:10px;>(.*)<\/div>/) - answer = $1 - # cache the answer - if(answer.length > 0) - @registry["#{trans_pair}/#{data_text}"] = answer - end - m.reply answer - return + lines.push l + end + + l = lines.join(" ") + debug "babelfish response: #{l}" + + if(l =~ /^\s+<td bgcolor=white class=s><div style=padding:10px;>(.*)<\/div>/) + answer = $1 + # cache the answer + if(answer.length > 0) + @registry["#{trans_pair}/#{data_text}"] = answer end + m.reply answer + return end m.reply "couldn't parse babelfish response html :(" else |