Skip to content

Commit 009f840

Browse files
committed
added voting and bopping
1 parent f373f14 commit 009f840

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ruby_ttapi/lib/ttapi.rb

+8-3
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,18 @@ def snag(callback=nil)
337337
end
338338

339339

340-
# TODO
341-
def vote
340+
def vote(direction = "up", callback = nil)
341+
vh = Digest::SHA1.hexdigest(@roomId + direction + @currentSongId)
342+
th = Digest::SHA1.hexdigest(Random.rand.to_s)
343+
ph = Digest::SHA1.hexdigest(Random.rand.to_s)
344+
rq = { "api" => 'room.vote', "roomid" => @roomId, "val" => direction, "vh" => vh, "th" => th, "ph" => ph }
345+
puts rq
346+
_send(rq, callback)
342347
end
343348

344349

345-
# TODO
346350
def bop
351+
vote
347352
end
348353

349354

0 commit comments

Comments
 (0)