refactor: load Twitch emotes from Helix (#5239)
This commit is contained in:
@@ -113,8 +113,8 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
|
||||
for (int i = 2; i < words.length(); i++)
|
||||
{
|
||||
{ // Twitch emote
|
||||
auto it = accemotes.emotes.find({words[i]});
|
||||
if (it != accemotes.emotes.end())
|
||||
auto it = accemotes->find({words[i]});
|
||||
if (it != accemotes->end())
|
||||
{
|
||||
b.emplace<EmoteElement>(it->second,
|
||||
MessageElementFlag::TwitchEmote);
|
||||
|
||||
@@ -95,26 +95,16 @@ void EmoteSource::initializeFromChannel(const Channel *channel)
|
||||
// returns true also for special Twitch channels (/live, /mentions, /whispers, etc.)
|
||||
if (channel->isTwitchChannel())
|
||||
{
|
||||
if (auto user = app->getAccounts()->twitch.getCurrent())
|
||||
{
|
||||
// Twitch Emotes available globally
|
||||
auto emoteData = user->accessEmotes();
|
||||
addEmotes(emotes, emoteData->emotes, "Twitch Emote");
|
||||
|
||||
// Twitch Emotes available locally
|
||||
auto localEmoteData = user->accessLocalEmotes();
|
||||
if ((tc != nullptr) &&
|
||||
localEmoteData->find(tc->roomId()) != localEmoteData->end())
|
||||
{
|
||||
if (const auto *localEmotes = &localEmoteData->at(tc->roomId()))
|
||||
{
|
||||
addEmotes(emotes, *localEmotes, "Local Twitch Emotes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tc)
|
||||
{
|
||||
if (auto twitch = tc->localTwitchEmotes())
|
||||
{
|
||||
addEmotes(emotes, *twitch, "Local Twitch Emotes");
|
||||
}
|
||||
|
||||
auto user = getApp()->getAccounts()->twitch.getCurrent();
|
||||
addEmotes(emotes, **user->accessEmotes(), "Twitch Emote");
|
||||
|
||||
// TODO extract "Channel {BetterTTV,7TV,FrankerFaceZ}" text into a #define.
|
||||
if (auto bttv = tc->bttvEmotes())
|
||||
{
|
||||
|
||||
@@ -99,7 +99,7 @@ bool IgnorePhrase::containsEmote() const
|
||||
for (const auto &acc : accvec)
|
||||
{
|
||||
const auto &accemotes = *acc->accessEmotes();
|
||||
for (const auto &emote : accemotes.emotes)
|
||||
for (const auto &emote : *accemotes)
|
||||
{
|
||||
if (this->replace_.contains(emote.first.string,
|
||||
Qt::CaseSensitive))
|
||||
|
||||
Reference in New Issue
Block a user