fuck
This commit is contained in:
parent
63985f0a7d
commit
e44630c3c3
10 changed files with 43 additions and 60 deletions
|
@ -9,6 +9,7 @@ module Handlers
|
|||
|
||||
# @@erm = [] of JSON::Any | Nil
|
||||
@@channel = Channel(JSON::Any).new
|
||||
|
||||
# @@buhh = ["bttv", "chatty"]
|
||||
#
|
||||
# def buh
|
||||
|
@ -42,45 +43,6 @@ module Handlers
|
|||
# pp "buh"
|
||||
# end
|
||||
def parse_badges(env)
|
||||
wg = WaitGroup.new(5)
|
||||
arrr = [] of JSON::Any
|
||||
# items = NamedTuple(chatterino: JSON::Any, chatty: JSON::Any, bttv: JSON::Any, dankchat: JSON::Any, ffz: JSON::Any)
|
||||
chatterino = Channel(JSON::Any).new
|
||||
chatty = Channel(JSON::Any).new
|
||||
bttv = Channel(JSON::Any).new
|
||||
dankchat = Channel(JSON::Any).new
|
||||
ffz = Channel(JSON::Any).new
|
||||
spawn do
|
||||
chatterino.send(Providers::Chatterino.get_badges)
|
||||
ensure
|
||||
wg.done
|
||||
end
|
||||
spawn do
|
||||
chatty.send(Providers::Chatty.get_badges)
|
||||
ensure
|
||||
wg.done
|
||||
end
|
||||
spawn do
|
||||
bttv.send(Providers::BTTV.get_badges)
|
||||
ensure
|
||||
wg.done
|
||||
end
|
||||
spawn do
|
||||
dankchat.send(Providers::DankChat.get_badges)
|
||||
ensure
|
||||
wg.done
|
||||
end
|
||||
spawn do
|
||||
ffz.send(Providers::FFZ.get_badges)
|
||||
ensure
|
||||
wg.done
|
||||
end
|
||||
# wg.wait
|
||||
items = {chatterino: chatterino.receive, bttv: bttv.receive, ffz: ffz.receive, dankchat: dankchat.receive, chatty: chatty.receive}
|
||||
# arrr << channel.receive
|
||||
# arrr << channel.receive
|
||||
# arrr << channel.receive
|
||||
# arrr << channel.receive
|
||||
pp items[:chatterino]
|
||||
badges_tuple = Providers.get_all_badges
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
module Providers::SevenTV
|
||||
|
||||
end
|
|
@ -45,8 +45,8 @@ module Providers::FFZ
|
|||
JSON.parse(res.body)
|
||||
end
|
||||
|
||||
# def get_channel(channel_id : String)
|
||||
# res = HTTP::Client.get("https://api.frankerfacez.com/v1/room/id/#{channel_id}", headers: HEADERS)
|
||||
# channel_data = JSON.parse(res.body)
|
||||
# def get_channel(channel_id : String)
|
||||
# res = HTTP::Client.get("https://api.frankerfacez.com/v1/room/id/#{channel_id}", headers: HEADERS)
|
||||
# channel_data = JSON.parse(res.body)
|
||||
|
||||
end
|
||||
|
|
22
src/providers/main.cr
Normal file
22
src/providers/main.cr
Normal file
|
@ -0,0 +1,22 @@
|
|||
module Providers
|
||||
extend self
|
||||
|
||||
def get_all_badges : NamedTuple
|
||||
# wg = WaitGroup.new(5)
|
||||
# arrr = [] of JSON::Any
|
||||
# items = NamedTuple(chatterino: JSON::Any, chatty: JSON::Any, bttv: JSON::Any, dankchat: JSON::Any, ffz: JSON::Any)
|
||||
# chatterino = Channel(JSON::Any).new
|
||||
# chatty = Channel(JSON::Any).new
|
||||
# bttv = Channel(JSON::Any).new
|
||||
# dankchat = Channel(JSON::Any).new
|
||||
# ffz = Channel(JSON::Any).new
|
||||
info = Array(Channel(JSON::Any)).new(5)
|
||||
# Compile with -Dpreview_mt
|
||||
spawn { info[0].send(Providers::Chatterino.get_badges) }
|
||||
spawn { info[1].send(Providers::Chatty.get_badges) }
|
||||
spawn { info[2].send(Providers::BTTV.get_badges) }
|
||||
spawn { info[3].send(Providers::DankChat.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}
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue