Add support FrankerFaceZ badges. (#2101)

On startup, we poll https://api.frankerfacez.com/v1/badges/ids and store the mappings of user IDs to badges for the remainder of the applications lifetime.
This commit is contained in:
Mm2PL
2020-10-25 09:36:00 +00:00
committed by GitHub
parent ec94869480
commit 3ee08b9ffd
16 changed files with 222 additions and 36 deletions
+32
View File
@@ -0,0 +1,32 @@
#pragma once
#include <boost/optional.hpp>
#include <common/Singleton.hpp>
#include "common/Aliases.hpp"
#include <map>
#include <vector>
namespace chatterino {
struct Emote;
using EmotePtr = std::shared_ptr<const Emote>;
class FfzBadges : public Singleton
{
public:
virtual void initialize(Settings &settings, Paths &paths) override;
FfzBadges() = default;
boost::optional<EmotePtr> getBadge(const UserId &id);
boost::optional<QColor> getBadgeColor(const UserId &id);
private:
void loadFfzBadges();
std::map<QString, int> badgeMap;
std::vector<EmotePtr> badges;
std::map<int, QColor> colorMap;
};
} // namespace chatterino