fuck
This commit is contained in:
parent
b837512329
commit
63985f0a7d
7 changed files with 83 additions and 27 deletions
|
@ -7,24 +7,80 @@ end
|
||||||
module Handlers
|
module Handlers
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
|
# @@erm = [] of JSON::Any | Nil
|
||||||
@@channel = Channel(JSON::Any).new
|
@@channel = Channel(JSON::Any).new
|
||||||
@@erm = [] of JSON::Any | Nil
|
# @@buhh = ["bttv", "chatty"]
|
||||||
@@buhh = ["bttv", "chatty"]
|
#
|
||||||
|
# def buh
|
||||||
def buh
|
# @@buhh.each do |iden|
|
||||||
@@buhh.each do |iden|
|
# spawn do
|
||||||
spawn do
|
# @@erm << Test.test(iden)
|
||||||
@@erm << Test.test(iden)
|
# # chatterino_badges = Providers::Chatterino.get_badges
|
||||||
# chatterino_badges = Providers::Chatterino.get_badges
|
# # chatty_badges = Providers::Chatty.get_badges
|
||||||
# chatty_badges = Providers::Chatty.get_badges
|
# # ffz_badges = Providers::FFZ.get_badges
|
||||||
# ffz_badges = Providers::FFZ.get_badges
|
# # dankchat_badges = Providers::DankChat.get_badges
|
||||||
# dankchat_badges = Providers::DankChat.get_badges
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# pp @@erm
|
||||||
pp @@erm
|
# end
|
||||||
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)
|
||||||
buh
|
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]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,6 @@ module Providers::BTTV
|
||||||
|
|
||||||
def get_badges
|
def get_badges
|
||||||
res = HTTP::Client.get("https://api.betterttv.net/3/cached/badges/twitch", headers: HEADERS)
|
res = HTTP::Client.get("https://api.betterttv.net/3/cached/badges/twitch", headers: HEADERS)
|
||||||
return JSON.parse(res.body)
|
JSON.parse(res.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ module Providers::Chatterino
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
def get_badges
|
def get_badges
|
||||||
res = HTTP::Client.get("https://api.chatterino.com/badges", headers: HEADERS)
|
res = HTTP::Client.get("https://api.chatterino.com/badges", headers: HEADERS)
|
||||||
return JSON.parse(res.body)
|
JSON.parse(res.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,6 @@ module Providers::Chatty
|
||||||
|
|
||||||
def get_badges
|
def get_badges
|
||||||
res = HTTP::Client.get("https://tduva.com/res/badges", headers: HEADERS)
|
res = HTTP::Client.get("https://tduva.com/res/badges", headers: HEADERS)
|
||||||
return JSON.parse(res.body)
|
JSON.parse(res.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,6 @@ module Providers::DankChat
|
||||||
|
|
||||||
def get_badges
|
def get_badges
|
||||||
res = HTTP::Client.get("https://flxrs.com/api/badges", headers: HEADERS)
|
res = HTTP::Client.get("https://flxrs.com/api/badges", headers: HEADERS)
|
||||||
return JSON.parse(res.body)
|
JSON.parse(res.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,7 +42,7 @@ module Providers::FFZ
|
||||||
|
|
||||||
def get_badges
|
def get_badges
|
||||||
res = HTTP::Client.get("https://api.frankerfacez.com/v1/badges/ids", headers: HEADERS)
|
res = HTTP::Client.get("https://api.frankerfacez.com/v1/badges/ids", headers: HEADERS)
|
||||||
return JSON.parse(res.body)
|
JSON.parse(res.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
# def get_channel(channel_id : String)
|
# def get_channel(channel_id : String)
|
||||||
|
|
|
@ -21,4 +21,4 @@ get "/badges" do |env|
|
||||||
Handlers.parse_badges(env)
|
Handlers.parse_badges(env)
|
||||||
end
|
end
|
||||||
|
|
||||||
Kemal.run
|
Kemal.run
|
||||||
|
|
Loading…
Reference in a new issue