2018-06-05 17:39:49 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-08-11 22:23:06 +02:00
|
|
|
#include <boost/optional.hpp>
|
2018-08-02 14:23:27 +02:00
|
|
|
#include <memory>
|
2018-08-11 22:23:06 +02:00
|
|
|
|
2018-08-11 14:20:53 +02:00
|
|
|
#include "common/Atomic.hpp"
|
2018-08-02 14:23:27 +02:00
|
|
|
#include "messages/Emote.hpp"
|
2018-06-05 17:39:49 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
2018-08-11 14:20:53 +02:00
|
|
|
class BttvEmotes final
|
2018-06-05 17:39:49 +02:00
|
|
|
{
|
2018-08-06 21:17:03 +02:00
|
|
|
static constexpr const char *globalEmoteApiUrl =
|
|
|
|
"https://api.betterttv.net/2/emotes";
|
2018-08-11 17:15:17 +02:00
|
|
|
static constexpr const char *bttvChannelEmoteApiUrl =
|
|
|
|
"https://api.betterttv.net/2/channels/";
|
2018-08-02 14:23:27 +02:00
|
|
|
|
2018-06-05 17:39:49 +02:00
|
|
|
public:
|
2018-08-11 14:20:53 +02:00
|
|
|
BttvEmotes();
|
2018-06-05 17:39:49 +02:00
|
|
|
|
2018-08-11 14:20:53 +02:00
|
|
|
std::shared_ptr<const EmoteMap> global() const;
|
|
|
|
boost::optional<EmotePtr> global(const EmoteName &name) const;
|
|
|
|
void loadGlobal();
|
2018-08-11 17:15:17 +02:00
|
|
|
static void loadChannel(const QString &channelName,
|
|
|
|
std::function<void(EmoteMap &&)> callback);
|
2018-06-05 17:39:49 +02:00
|
|
|
|
2018-06-07 12:22:28 +02:00
|
|
|
private:
|
2018-08-11 14:20:53 +02:00
|
|
|
Atomic<std::shared_ptr<const EmoteMap>> global_;
|
2018-06-05 17:39:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|