diff --git a/src/providers/twitch/TwitchAccount.cpp b/src/providers/twitch/TwitchAccount.cpp index 6b4778a7..3d5c6d4d 100644 --- a/src/providers/twitch/TwitchAccount.cpp +++ b/src/providers/twitch/TwitchAccount.cpp @@ -216,7 +216,7 @@ void TwitchAccount::loadEmotes(std::weak_ptr 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 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 diff --git a/src/providers/twitch/TwitchAccount.hpp b/src/providers/twitch/TwitchAccount.hpp index eac11f06..4d1d6be6 100644 --- a/src/providers/twitch/TwitchAccount.hpp +++ b/src/providers/twitch/TwitchAccount.hpp @@ -114,7 +114,7 @@ public: void loadEmotes(std::weak_ptr 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 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);