-
-
Notifications
You must be signed in to change notification settings - Fork 442
/
SeventvEmotes.hpp
73 lines (58 loc) · 2.24 KB
/
SeventvEmotes.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once
#include "boost/optional.hpp"
#include "common/Aliases.hpp"
#include "common/Atomic.hpp"
#include "providers/twitch/TwitchChannel.hpp"
#include <memory>
namespace chatterino {
// https://github.com/SevenTV/API/blob/a84e884b5590dbb5d91a5c6b3548afabb228f385/data/model/emote-set.model.go#L29-L36
enum class SeventvActiveEmoteFlag : int64_t {
None = 0LL,
// Emote is zero-width
ZeroWidth = (1LL << 0),
// Overrides Twitch Global emotes with the same name
OverrideTwitchGlobal = (1 << 16),
// Overrides Twitch Subscriber emotes with the same name
OverrideTwitchSubscriber = (1 << 17),
// Overrides BetterTTV emotes with the same name
OverrideBetterTTV = (1 << 18),
};
// https://github.com/SevenTV/API/blob/a84e884b5590dbb5d91a5c6b3548afabb228f385/data/model/emote.model.go#L57-L70
enum class SeventvEmoteFlag : int64_t {
None = 0LL,
// The emote is private and can only be accessed by its owner, editors and moderators
Private = 1 << 0,
// The emote was verified to be an original creation by the uploader
Authentic = (1LL << 1),
// The emote is recommended to be enabled as Zero-Width
ZeroWidth = (1LL << 8),
// Content Flags
// Sexually Suggesive
ContentSexual = (1LL << 16),
// Rapid flashing
ContentEpilepsy = (1LL << 17),
// Edgy or distasteful, may be offensive to some users
ContentEdgy = (1 << 18),
// Not allowed specifically on the Twitch platform
ContentTwitchDisallowed = (1LL << 24),
};
using SeventvActiveEmoteFlags = FlagsEnum<SeventvActiveEmoteFlag>;
using SeventvEmoteFlags = FlagsEnum<SeventvEmoteFlag>;
struct Emote;
using EmotePtr = std::shared_ptr<const Emote>;
class EmoteMap;
class SeventvEmotes final
{
public:
SeventvEmotes();
std::shared_ptr<const EmoteMap> globalEmotes() const;
boost::optional<EmotePtr> globalEmote(const EmoteName &name) const;
void loadGlobalEmotes();
static void loadChannelEmotes(const std::weak_ptr<Channel> &channel,
const QString &channelId,
std::function<void(EmoteMap &&)> callback,
bool manualRefresh);
private:
Atomic<std::shared_ptr<const EmoteMap>> global_;
};
} // namespace chatterino