Created
June 28, 2011 19:15
-
-
Save naltatis/1051944 to your computer and use it in GitHub Desktop.
ruby bot
This file contains 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 'net/http' | |
# replace with you api-token from http://botliga.de/einstellungen | |
bot_token = "abc123" | |
# you find a full list with more data at http://botliga.de/datenquellen | |
next_matches = [14181, 14182, 14183] | |
http = Net::HTTP.new('botliga.de',80) | |
next_matches.each do |match_id| | |
# insert smart voodoo calculations here | |
result = "#{rand(4)}:#{rand(4)}" | |
# post your guess | |
response, data = http.post('/api/guess',"match_id=#{match_id}&result=#{result}&token=#{bot_token}") | |
# "201 Created" (initial guess) or "200 OK" (guess update) | |
puts "#{response.code} #{data}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment