Skip to content

Instantly share code, notes, and snippets.

@badboy
Created March 26, 2009 14:55
Show Gist options
  • Save badboy/86135 to your computer and use it in GitHub Desktop.
Save badboy/86135 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'lib/jabbot'
configure do |conf|
conf.login = 'geheim@server'
conf.channel = 'spamalot'
conf.server = 'conference.server'
conf.password = 'noch_geheimer'
end
def calc(msg)
IO.popen("ruby19 calculator.rb", 'w+') { |r| r.write("#{msg}\nquit\n"); r.read }
end
message /^.calc (.+)$/m do |message, params|
calculation = params[:matches].first
post calc(calculation)
end
message ".answer :me" do |message, params|
post "ey, ja! wieso soll ich \"#{params[:me]}\" sagen, hm?"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment