Added system message if no bttv emotes found instead of "unknown error" (#2542)
Co-authored-by: Paweł <zneix@zneix.eu> Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -81,6 +81,7 @@
|
|||||||
- Bugfix: Fixed hidden tooltips when always on top is active (#2384)
|
- Bugfix: Fixed hidden tooltips when always on top is active (#2384)
|
||||||
- Bugfix: Fix CLI arguments (`--help`, `--version`, `--channels`) not being respected (#2368, #2190)
|
- Bugfix: Fix CLI arguments (`--help`, `--version`, `--channels`) not being respected (#2368, #2190)
|
||||||
- Bugfix: Fix Twitch cheer emotes not displaying tooltips when hovered (#2434, #2503)
|
- Bugfix: Fix Twitch cheer emotes not displaying tooltips when hovered (#2434, #2503)
|
||||||
|
- Bugfix: Fix BTTV/FFZ channel emotes saying unknown error when no emotes found (#2542)
|
||||||
- Bugfix: Fix directory not opening when clicking "Open AppData Directory" setting button on macOS (#2531, #2537)
|
- Bugfix: Fix directory not opening when clicking "Open AppData Directory" setting button on macOS (#2531, #2537)
|
||||||
- Dev: Updated minimum required Qt framework version to 5.12. (#2210)
|
- Dev: Updated minimum required Qt framework version to 5.12. (#2210)
|
||||||
- Dev: Migrated `Kraken::getUser` to Helix (#2260)
|
- Dev: Migrated `Kraken::getUser` to Helix (#2260)
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
const QString CHANNEL_HAS_NO_EMOTES(
|
||||||
|
"This channel has no BetterTTV channel emotes.");
|
||||||
|
|
||||||
QString emoteLinkFormat("https://betterttv.com/emotes/%1");
|
QString emoteLinkFormat("https://betterttv.com/emotes/%1");
|
||||||
|
|
||||||
Url getEmoteLink(QString urlTemplate, const EmoteId &id,
|
Url getEmoteLink(QString urlTemplate, const EmoteId &id,
|
||||||
@@ -164,23 +167,37 @@ void BttvEmotes::loadChannel(std::weak_ptr<Channel> channel,
|
|||||||
manualRefresh](auto result) -> Outcome {
|
manualRefresh](auto result) -> Outcome {
|
||||||
auto pair =
|
auto pair =
|
||||||
parseChannelEmotes(result.parseJson(), channelDisplayName);
|
parseChannelEmotes(result.parseJson(), channelDisplayName);
|
||||||
|
bool hasEmotes = false;
|
||||||
if (pair.first)
|
if (pair.first)
|
||||||
|
{
|
||||||
|
hasEmotes = !pair.second.empty();
|
||||||
callback(std::move(pair.second));
|
callback(std::move(pair.second));
|
||||||
|
}
|
||||||
if (auto shared = channel.lock(); manualRefresh)
|
if (auto shared = channel.lock(); manualRefresh)
|
||||||
shared->addMessage(
|
{
|
||||||
makeSystemMessage("BetterTTV channel emotes reloaded."));
|
if (hasEmotes)
|
||||||
|
{
|
||||||
|
shared->addMessage(makeSystemMessage(
|
||||||
|
"BetterTTV channel emotes reloaded."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shared->addMessage(
|
||||||
|
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
|
||||||
|
}
|
||||||
|
}
|
||||||
return pair.first;
|
return pair.first;
|
||||||
})
|
})
|
||||||
.onError([channelId, channel, manualRefresh](auto result) {
|
.onError([channelId, channel, manualRefresh](auto result) {
|
||||||
auto shared = channel.lock();
|
auto shared = channel.lock();
|
||||||
if (!shared)
|
if (!shared)
|
||||||
return;
|
return;
|
||||||
if (result.status() == 203)
|
if (result.status() == 404)
|
||||||
{
|
{
|
||||||
// User does not have any BTTV emotes
|
// User does not have any BTTV emotes
|
||||||
if (manualRefresh)
|
if (manualRefresh)
|
||||||
shared->addMessage(makeSystemMessage(
|
shared->addMessage(
|
||||||
"This channel has no BetterTTV channel emotes."));
|
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
|
||||||
}
|
}
|
||||||
else if (result.status() == NetworkResult::timedoutStatus)
|
else if (result.status() == NetworkResult::timedoutStatus)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
const QString CHANNEL_HAS_NO_EMOTES(
|
||||||
|
"This channel has no FrankerFaceZ channel emotes.");
|
||||||
|
|
||||||
Url getEmoteLink(const QJsonObject &urls, const QString &emoteScale)
|
Url getEmoteLink(const QJsonObject &urls, const QString &emoteScale)
|
||||||
{
|
{
|
||||||
auto emote = urls.value(emoteScale);
|
auto emote = urls.value(emoteScale);
|
||||||
@@ -210,11 +214,23 @@ void FfzEmotes::loadChannel(
|
|||||||
auto emoteMap = parseChannelEmotes(json);
|
auto emoteMap = parseChannelEmotes(json);
|
||||||
auto modBadge = parseModBadge(json);
|
auto modBadge = parseModBadge(json);
|
||||||
|
|
||||||
|
bool hasEmotes = !emoteMap.empty();
|
||||||
|
|
||||||
emoteCallback(std::move(emoteMap));
|
emoteCallback(std::move(emoteMap));
|
||||||
modBadgeCallback(std::move(modBadge));
|
modBadgeCallback(std::move(modBadge));
|
||||||
if (auto shared = channel.lock(); manualRefresh)
|
if (auto shared = channel.lock(); manualRefresh)
|
||||||
shared->addMessage(
|
{
|
||||||
makeSystemMessage("FrankerFaceZ channel emotes reloaded."));
|
if (hasEmotes)
|
||||||
|
{
|
||||||
|
shared->addMessage(makeSystemMessage(
|
||||||
|
"FrankerFaceZ channel emotes reloaded."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shared->addMessage(
|
||||||
|
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
})
|
})
|
||||||
@@ -222,12 +238,12 @@ void FfzEmotes::loadChannel(
|
|||||||
auto shared = channel.lock();
|
auto shared = channel.lock();
|
||||||
if (!shared)
|
if (!shared)
|
||||||
return;
|
return;
|
||||||
if (result.status() == 203)
|
if (result.status() == 404)
|
||||||
{
|
{
|
||||||
// User does not have any FFZ emotes
|
// User does not have any FFZ emotes
|
||||||
if (manualRefresh)
|
if (manualRefresh)
|
||||||
shared->addMessage(makeSystemMessage(
|
shared->addMessage(
|
||||||
"This channel has no FrankerFaceZ channel emotes."));
|
makeSystemMessage(CHANNEL_HAS_NO_EMOTES));
|
||||||
}
|
}
|
||||||
else if (result.status() == NetworkResult::timedoutStatus)
|
else if (result.status() == NetworkResult::timedoutStatus)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user