#pragma once #include "common/Aliases.hpp" #include "common/UniqueAccess.hpp" #include #include #include #include #include namespace chatterino { // NB: "default" can be replaced with "static" to always get a non-animated // variant /// %1 <-> {id} /// %2 <-> {scale} (1.0, 2.0, 3.0) constexpr QStringView TWITCH_EMOTE_TEMPLATE = u"https://static-cdn.jtvnw.net/emoticons/v2/%1/default/dark/%2"; struct Emote; using EmotePtr = std::shared_ptr; struct CheerEmote { QColor color; int minBits; QRegularExpression regex; EmotePtr animatedEmote; EmotePtr staticEmote; }; struct CheerEmoteSet { QRegularExpression regex; std::vector cheerEmotes; }; class ITwitchEmotes { public: virtual ~ITwitchEmotes() = default; virtual EmotePtr getOrCreateEmote(const EmoteId &id, const EmoteName &name) = 0; }; class TwitchEmotes : public ITwitchEmotes { public: static QString cleanUpEmoteCode(const QString &dirtyEmoteCode); TwitchEmotes() = default; EmotePtr getOrCreateEmote(const EmoteId &id, const EmoteName &name) override; private: UniqueAccess>> twitchEmotesCache_; }; } // namespace chatterino