fix: re-add missing Twitch emote reload message (#3645)

Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
This commit is contained in:
James Upjohn 2022-04-05 20:01:18 +12:00 committed by GitHub
parent cd64607295
commit f76306c6fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -216,7 +216,7 @@ void TwitchAccount::loadEmotes(std::weak_ptr<Channel> weakChannel)
qCDebug(chatterinoTwitch) << "Cleared emotes!";
}
this->loadUserstateEmotes();
this->loadUserstateEmotes(weakChannel);
}
bool TwitchAccount::setUserstateEmoteSets(QStringList newEmoteSets)
@ -234,7 +234,7 @@ bool TwitchAccount::setUserstateEmoteSets(QStringList newEmoteSets)
return true;
}
void TwitchAccount::loadUserstateEmotes()
void TwitchAccount::loadUserstateEmotes(std::weak_ptr<Channel> weakChannel)
{
if (this->userstateEmoteSets_.isEmpty())
{
@ -281,7 +281,7 @@ void TwitchAccount::loadUserstateEmotes()
.arg(batches.at(i).join(","));
getIvr()->getBulkEmoteSets(
batches.at(i).join(","),
[this](QJsonArray emoteSetArray) {
[this, weakChannel](QJsonArray emoteSetArray) {
auto emoteData = this->emotes_.access();
auto localEmoteData = this->localEmotes_.access();
for (auto emoteSet_ : emoteSetArray)
@ -348,6 +348,12 @@ void TwitchAccount::loadUserstateEmotes()
});
emoteData->emoteSets.emplace_back(emoteSet);
}
if (auto channel = weakChannel.lock(); channel != nullptr)
{
channel->addMessage(makeSystemMessage(
"Twitch subscriber emotes reloaded."));
}
},
[] {
// fetching emotes failed, ivr API might be down

View file

@ -114,7 +114,7 @@ public:
void loadEmotes(std::weak_ptr<Channel> weakChannel = {});
// loadUserstateEmotes loads emote sets that are part of the USERSTATE emote-sets key
// this function makes sure not to load emote sets that have already been loaded
void loadUserstateEmotes();
void loadUserstateEmotes(std::weak_ptr<Channel> weakChannel = {});
// setUserStateEmoteSets sets the emote sets that were parsed from the USERSTATE emote-sets key
// Returns true if the newly inserted emote sets differ from the ones previously saved
[[nodiscard]] bool setUserstateEmoteSets(QStringList newEmoteSets);