mirror-chatterino2/src/providers/bttv/BttvEmotes.hpp
2019-09-03 23:32:22 +02:00

35 lines
869 B
C++

#pragma once
#include <memory>
#include "boost/optional.hpp"
#include "common/Aliases.hpp"
#include "common/Atomic.hpp"
namespace chatterino {
struct Emote;
using EmotePtr = std::shared_ptr<const Emote>;
class EmoteMap;
class BttvEmotes final
{
static constexpr const char *globalEmoteApiUrl =
"https://api.betterttv.net/3/cached/emotes/global";
static constexpr const char *bttvChannelEmoteApiUrl =
"https://api.betterttv.net/3/cached/users/twitch/";
public:
BttvEmotes();
std::shared_ptr<const EmoteMap> emotes() const;
boost::optional<EmotePtr> emote(const EmoteName &name) const;
void loadEmotes();
static void loadChannel(const QString &channelId,
std::function<void(EmoteMap &&)> callback);
private:
Atomic<std::shared_ptr<const EmoteMap>> global_;
};
} // namespace chatterino