blob: 80fc8548ea346b4b9c1a6fa3336829a0f5bd121d (
plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#include "stream.hpp"
namespace bot::schemas {
EventType string_to_event_type(const std::string &type) {
if (type == "live") {
return EventType::LIVE;
} else if (type == "offline") {
return EventType::OFFLINE;
} else if (type == "title") {
return EventType::TITLE;
} else if (type == "game") {
return EventType::GAME;
} else if (type == "kick_live") {
return EventType::KICK_LIVE;
} else if (type == "kick_offline") {
return EventType::KICK_OFFLINE;
} else if (type == "kick_title") {
return EventType::KICK_TITLE;
} else if (type == "kick_game") {
return EventType::KICK_GAME;
} else if (type == "github") {
return EventType::GITHUB;
} else if (type == "7tv_new_emote") {
return EventType::STV_EMOTE_CREATE;
} else if (type == "7tv_deleted_emote") {
return EventType::STV_EMOTE_DELETE;
} else if (type == "7tv_updated_emote") {
return EventType::STV_EMOTE_UPDATE;
}
#ifdef BUILD_BETTERTTV
else if (type == "bttv_new_emote") {
return EventType::BTTV_EMOTE_CREATE;
} else if (type == "bttv_deleted_emote") {
return EventType::BTTV_EMOTE_DELETE;
} else if (type == "bttv_updated_emote") {
return EventType::BTTV_EMOTE_UPDATE;
}
#endif
else if (type == "rss") {
return EventType::RSS;
} else if (type == "twitter") {
return EventType::TWITTER;
} else if (type == "telegram") {
return EventType::TELEGRAM;
} else {
return EventType::CUSTOM;
}
}
std::string event_type_to_string(const int &type) {
if (type == LIVE) {
return "live";
} else if (type == OFFLINE) {
return "offline";
} else if (type == TITLE) {
return "title";
} else if (type == GAME) {
return "game";
} else if (type == KICK_LIVE) {
return "kick_live";
} else if (type == KICK_OFFLINE) {
return "kick_offline";
} else if (type == KICK_TITLE) {
return "kick_title";
} else if (type == KICK_GAME) {
return "kick_game";
} else if (type == GITHUB) {
return "github";
} else if (type == STV_EMOTE_CREATE) {
return "7tv_new_emote";
} else if (type == STV_EMOTE_DELETE) {
return "7tv_deleted_emote";
} else if (type == STV_EMOTE_UPDATE) {
return "7tv_updated_emote";
}
#ifdef BUILD_BETTERTTV
else if (type == BTTV_EMOTE_CREATE) {
return "bttv_new_emote";
} else if (type == BTTV_EMOTE_DELETE) {
return "bttv_deleted_emote";
} else if (type == BTTV_EMOTE_UPDATE) {
return "bttv_updated_emote";
}
#endif
else {
return "custom";
}
}
std::optional<int> string_to_event_flag(const std::string &type) {
if (type == "massping") {
return MASSPING;
}
return std::nullopt;
}
std::optional<std::string> event_flag_to_string(const int &type) {
if (type == MASSPING) {
return "massping";
}
return std::nullopt;
}
}
|