0.2.3: Fix subage information

This commit is contained in:
Fijxu 2024-07-03 17:22:26 -04:00
parent 5ba089cc72
commit fc2957a601
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4
2 changed files with 36 additions and 41 deletions

View file

@ -27,6 +27,14 @@ module TwAPI::Datahandlers::Twitch
end
end
private macro isBanned2(gql, mode)
if {{gql}}["userResultBy#{{mode}}"]["reason"]?
true
else
false
end
end
def user(env)
mode = env.params.query.has_key?("id") ? "ID" : "Login"
@ -391,7 +399,7 @@ module TwAPI::Datahandlers::Twitch
json.field "daysRemaining", gql["info"]["relationship"]["streak"]["daysRemaining"]?
json.field "months", gql["info"]["relationship"]["streak"]["months"]?
json.field "end", gql["info"]["relationship"]["streak"]["end"]?
json.field "start", gql["info"]["relationship"]["streak"]["elapsedDays"]?
json.field "start", gql["info"]["relationship"]["streak"]["start"]?
end
end
end
@ -404,7 +412,7 @@ module TwAPI::Datahandlers::Twitch
json.field "daysRemaining", gql["info"]["relationship"]["cumulative"]["daysRemaining"]?
json.field "months", gql["info"]["relationship"]["cumulative"]["months"]?
json.field "end", gql["info"]["relationship"]["cumulative"]["end"]?
json.field "start", gql["info"]["relationship"]["cumulative"]["elapsedDays"]?
json.field "start", gql["info"]["relationship"]["cumulative"]["start"]?
end
end
end
@ -413,8 +421,14 @@ module TwAPI::Datahandlers::Twitch
else
json.field "meta" do
json.object do
json.field "type", nil # TODO: get the type of the sub, could be paid or something else gql["info"]["relationship"]["meta"][""]
json.field "tier", (gql["info"]["relationship"]["meta"]["tier"].to_s.to_i / 1000)
if json.field "type", gql["info"]["relationship"]["meta"]["giftMeta"]["isGift"] == false
json.field "type", "paid"
elsif gql["info"]["relationship"]["meta"]["purchasedWithPrime"] == true
json.field "type", "prime"
else
json.field "type", "gift"
end
json.field "tier", (gql["info"]["relationship"]["meta"]["tier"].to_s.to_i // 1000)
json.field "endsAt", gql["info"]["relationship"]["meta"]["endsAt"]
json.field "renewsAt", gql["info"]["relationship"]["meta"]["renewsAt"]
json.field "giftMeta", nil # TODO: fill giftMeta is sub is gifted

View file

@ -30,33 +30,23 @@ module TwAPI::TwitchAPI::GQL
emoticonPrefix { name }
panels(hideExtensions: false) { id type }
followers { totalCount }
roles {
isStaff
isAffiliate
isPartner
isExtensionsDeveloper
}
displayBadges {
setID
title
description
version
}
roles { isStaff isAffiliate isPartner isExtensionsDeveloper }
displayBadges { setID title description version }
chatSettings {
autoModLevel
blockLinks
chatDelayMs
followersOnlyDurationMinutes
isBroadcasterLanguageModeEnabled
isEmoteOnlyModeEnabled
isFastSubsModeEnabled
isOptedOutOfGlobalBannedWordsList
isSubscribersOnlyModeEnabled
isUniqueChatModeEnabled
requireVerifiedAccount
rules
slowModeDurationSeconds
}
autoModLevel
blockLinks
chatDelayMs
followersOnlyDurationMinutes
isBroadcasterLanguageModeEnabled
isEmoteOnlyModeEnabled
isFastSubsModeEnabled
isOptedOutOfGlobalBannedWordsList
isSubscribersOnlyModeEnabled
isUniqueChatModeEnabled
requireVerifiedAccount
rules
slowModeDurationSeconds
}
stream {
averageFPS
bitrate
@ -69,18 +59,9 @@ module TwAPI::TwitchAPI::GQL
type
game{displayName}
}
lastBroadcast {
game{displayName}
id
startedAt
title
}
lastBroadcast { game{displayName} id startedAt title }
channel {
chatters {
count
moderators { login }
vips { login }
}
chatters { count moderators {login} vips {login} }
}
}
}