Sha256: e913c304bc9ae6244178d59bc16942969b28209a2e9945355ae04bd58b932abf

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

require 'net/http'
require 'uri'
require 'cgi'

class Translate < Linkbot::Plugin
    def self.on_message(message, matches)
      res = Net::HTTP.post_form(URI.parse('http://www.cs.utexas.edu/users/jbc/bork/bork.cgi'),
                                 {'input'=> CGI.unescapeHTML(message_history[1]['body']), 'type'=>'chef'})
      CGI::unescape(res.body.to_s.gsub("&epus;","'"))
    end
    
    def self.help
      "!translate - Trunslete-a zee lest messege-a"
    end
    
    Linkbot::Plugin.register('translate', self,
      {
        :message => {:regex => /!translate/, :handler => :on_message, :help => :help}
      }
    )
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
protolink-0.2.8 example/linkbot/plugins/translate.rb