Fix emotesets not loading properly (#2905)
* Initial work fk I'm so tired... * Updated Twitch API documentation * Futher changes * Removed debug output * Added changelog entry * Advice: don't code at 4am removed all silly debug stuff * Add missing lambda capture
This commit is contained in:
@@ -761,6 +761,38 @@ void Helix::getCheermotes(
|
||||
.execute();
|
||||
}
|
||||
|
||||
void Helix::getEmoteSetData(QString emoteSetId,
|
||||
ResultCallback<HelixEmoteSetData> successCallback,
|
||||
HelixFailureCallback failureCallback)
|
||||
{
|
||||
QUrlQuery urlQuery;
|
||||
|
||||
urlQuery.addQueryItem("emote_set_id", emoteSetId);
|
||||
|
||||
this->makeRequest("chat/emotes/set", urlQuery)
|
||||
.onSuccess([successCallback, failureCallback,
|
||||
emoteSetId](auto result) -> Outcome {
|
||||
QJsonObject root = result.parseJson();
|
||||
auto data = root.value("data");
|
||||
|
||||
if (!data.isArray())
|
||||
{
|
||||
failureCallback();
|
||||
return Failure;
|
||||
}
|
||||
|
||||
HelixEmoteSetData emoteSetData(data.toArray()[0].toObject());
|
||||
|
||||
successCallback(emoteSetData);
|
||||
return Success;
|
||||
})
|
||||
.onError([failureCallback](NetworkResult result) {
|
||||
// TODO: make better xd
|
||||
failureCallback();
|
||||
})
|
||||
.execute();
|
||||
}
|
||||
|
||||
NetworkRequest Helix::makeRequest(QString url, QUrlQuery urlQuery)
|
||||
{
|
||||
assert(!url.startsWith("/"));
|
||||
|
||||
Reference in New Issue
Block a user