Clean up TwitchAccount emote stuff (#4243)

* Remove unused TwitchAccount FollowResult enum

* Remove unused TwitchEmoteSetResolverResponse struct

* Remove unused and unimplemented `getEmoteSetBatches` function definition

* Remove unused `loadEmoteSetData` and `staticEmoteSets` from
TwitchAccount

* Remove forward declaration of TwitchAccount in TwitchAccountManager

* Clean up IgnorePhrase includes

* add missing newline in pubsubmanager.cpp
This commit is contained in:
pajlada
2022-12-18 15:36:39 +01:00
committed by GitHub
parent 8830b0e01c
commit a715b1ffff
27 changed files with 174 additions and 212 deletions
-67
View File
@@ -442,71 +442,4 @@ void TwitchAccount::autoModDeny(const QString msgID, ChannelPtr channel)
});
}
void TwitchAccount::loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet)
{
if (!emoteSet)
{
qCWarning(chatterinoTwitch) << "null emote set sent";
return;
}
auto staticSetIt = this->staticEmoteSets.find(emoteSet->key);
if (staticSetIt != this->staticEmoteSets.end())
{
const auto &staticSet = staticSetIt->second;
emoteSet->channelName = staticSet.channelName;
emoteSet->text = staticSet.text;
return;
}
getHelix()->getEmoteSetData(
emoteSet->key,
[emoteSet](HelixEmoteSetData emoteSetData) {
// Follower emotes can be only used in their origin channel
if (emoteSetData.emoteType == "follower")
{
emoteSet->local = true;
}
if (emoteSetData.ownerId.isEmpty() ||
emoteSetData.setId != emoteSet->key)
{
qCDebug(chatterinoTwitch)
<< QString("Failed to fetch emoteSetData for %1, assuming "
"Twitch is the owner")
.arg(emoteSet->key);
// most (if not all) emotes that fail to load are time limited event emotes owned by Twitch
emoteSet->channelName = "twitch";
emoteSet->text = "Twitch";
return;
}
// emote set 0 = global emotes
if (emoteSetData.ownerId == "0")
{
// emoteSet->channelName = QString();
emoteSet->text = "Twitch Global";
return;
}
getHelix()->getUserById(
emoteSetData.ownerId,
[emoteSet](HelixUser user) {
emoteSet->channelName = user.login;
emoteSet->text = user.displayName;
},
[emoteSetData] {
qCWarning(chatterinoTwitch)
<< "Failed to query user by id:" << emoteSetData.ownerId
<< emoteSetData.setId;
});
},
[emoteSet] {
// fetching emoteset data failed
return;
});
}
} // namespace chatterino