Skip to content

Instantly share code, notes, and snippets.

@naltatis
Created June 28, 2011 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naltatis/1051944 to your computer and use it in GitHub Desktop.
Save naltatis/1051944 to your computer and use it in GitHub Desktop.
ruby bot
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