-
-
Save hackervera/502937 to your computer and use it in GitHub Desktop.
issac bot ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'isaac' | |
configure do |c| | |
c.nick = "icecondor" | |
c.server = "irc.freenode.net" | |
c.port = 6667 | |
end | |
on :connect do | |
join "#geoloqi" | |
end | |
on :channel, /^icecondor: where is (.*)/ do | |
msg channel, "#{nick}: I dont know where '#{match[0]}' is. " | |
end | |
on :channel, /^icecondor: foursquare (.*) (.*)/ do |lat,long| | |
msg channel, "#{nick}: closest venue: #{closest_foursquare(lat,long)}" | |
end | |
on :channel, /^icecondor: (.*)/ do | |
msg channel, "Quote: '#{match[0]}' by #{nick}" | |
end | |
def closest_foursquare(lat,long) | |
j= JSON.parse(`curl -u user:pass 'http://api.foursquare.com/v1/venues.json?geolat=#{lat}&geolong=#{long}'`) | |
j["error"] || j["groups"].first["venues"].first["name"] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment