Skip to content

Instantly share code, notes, and snippets.

@blizzarddreams
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save blizzarddreams/cd4ef3d93c716f137bd7 to your computer and use it in GitHub Desktop.

Select an option

Save blizzarddreams/cd4ef3d93c716f137bd7 to your computer and use it in GitHub Desktop.
url = "http://play.pokemonshowdown.com/action.php"
if @pass.nil?
data = RestClient.get url, :act => 'getassertion', :userid => @name, :challengekeyid => m[2], :challenge => m[3]
ws.send("|/trn #{@name}, 0, #{data}")
else
data = RestClient.post url, :act => 'login', :name => @name, :pass => @pass, :challengekeyid => m[2], :challenge => m[3]
data = JSON.parse(data.split(']')[1])
ws.send("|/trn #{@name}, 0, #{data['assertion']}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment