0.0.0.0.9
This commit is contained in:
parent
e44630c3c3
commit
4732407d48
2 changed files with 26 additions and 48 deletions
|
@ -1,48 +1,24 @@
|
||||||
require "wait_group"
|
|
||||||
|
|
||||||
macro xd(ident)
|
|
||||||
Providers::{{ident}}.get_badges
|
|
||||||
end
|
|
||||||
|
|
||||||
module Handlers
|
module Handlers
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
# @@erm = [] of JSON::Any | Nil
|
|
||||||
@@channel = Channel(JSON::Any).new
|
|
||||||
|
|
||||||
# @@buhh = ["bttv", "chatty"]
|
|
||||||
#
|
|
||||||
# def buh
|
|
||||||
# @@buhh.each do |iden|
|
|
||||||
# spawn do
|
|
||||||
# @@erm << Test.test(iden)
|
|
||||||
# # chatterino_badges = Providers::Chatterino.get_badges
|
|
||||||
# # chatty_badges = Providers::Chatty.get_badges
|
|
||||||
# # ffz_badges = Providers::FFZ.get_badges
|
|
||||||
# # dankchat_badges = Providers::DankChat.get_badges
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# pp @@erm
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# def parse_badges(env)
|
|
||||||
# wg = WaitGroup.new
|
|
||||||
# spawn do
|
|
||||||
# puts "Chatterino"
|
|
||||||
# Providers::Chatterino.get_badges
|
|
||||||
# ensure
|
|
||||||
# wg.done
|
|
||||||
# end
|
|
||||||
# spawn do
|
|
||||||
# puts "Chatty"
|
|
||||||
# Providers::Chatty.get_badges
|
|
||||||
# ensure
|
|
||||||
# wg.done
|
|
||||||
# end
|
|
||||||
# wg.wait
|
|
||||||
# pp "buh"
|
|
||||||
# end
|
|
||||||
def parse_badges(env)
|
def parse_badges(env)
|
||||||
badges_tuple = Providers.get_all_badges
|
badges_tuple = Providers.get_all_badges
|
||||||
|
JSON.build do |j|
|
||||||
|
j.object do
|
||||||
|
j.field "chatterino" do
|
||||||
|
j.object do
|
||||||
|
j.field "badges" do
|
||||||
|
j.object do
|
||||||
|
j.field "name", badges_tuple[:chatterino]["badges"][0]["tooltip"]
|
||||||
|
# j.field "url1x", badges_tuple[:chatterino].
|
||||||
|
# j.field "url2x", badges_tuple[:chatterino].
|
||||||
|
# j.field "url3x", badges_tuple[:chatterino].
|
||||||
|
# j.field "users", badges_tuple[:chatterino].
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,13 +10,15 @@ module Providers
|
||||||
# bttv = Channel(JSON::Any).new
|
# bttv = Channel(JSON::Any).new
|
||||||
# dankchat = Channel(JSON::Any).new
|
# dankchat = Channel(JSON::Any).new
|
||||||
# ffz = Channel(JSON::Any).new
|
# ffz = Channel(JSON::Any).new
|
||||||
info = Array(Channel(JSON::Any)).new(5)
|
info = [Channel(JSON::Any).new,Channel(JSON::Any).new,Channel(JSON::Any).new,Channel(JSON::Any).new,Channel(JSON::Any).new]
|
||||||
# Compile with -Dpreview_mt
|
# Compile with -Dpreview_mt
|
||||||
spawn { info[0].send(Providers::Chatterino.get_badges) }
|
spawn { info[0].send(Providers::Chatterino.get_badges) }
|
||||||
spawn { info[1].send(Providers::Chatty.get_badges) }
|
# spawn { info[1].send(Providers::Chatty.get_badges) }
|
||||||
spawn { info[2].send(Providers::BTTV.get_badges) }
|
# spawn { info[2].send(Providers::BTTV.get_badges) }
|
||||||
spawn { info[3].send(Providers::DankChat.get_badges) }
|
# spawn { info[3].send(Providers::DankChat.get_badges) }
|
||||||
spawn { info[4].send(Providers::FFZ.get_badges) }
|
# spawn { info[4].send(Providers::FFZ.get_badges) }
|
||||||
items = {chatterino: info[0].receive, bttv: bttv.receive, ffz: ffz.receive, dankchat: dankchat.receive, chatty: chatty.receive}
|
# items = {chatterino: info[0].receive, bttv: info.receive, ffz: ffz.receive, dankchat: dankchat.receive, chatty: chatty.receive}
|
||||||
|
items = {chatterino: info[0].receive}
|
||||||
|
return items
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue