Made cleanUpCode() as static TwitchEmotes's method.
This commit is contained in:
@@ -13,6 +13,33 @@ TwitchEmotes::TwitchEmotes()
|
||||
{
|
||||
}
|
||||
|
||||
QString TwitchEmotes::cleanUpEmoteCode(const EmoteName &dirtyEmoteCode)
|
||||
{
|
||||
auto cleanCode = dirtyEmoteCode.string;
|
||||
cleanCode.detach();
|
||||
|
||||
static QMap<QString, QString> emoteNameReplacements{
|
||||
{"[oO](_|\\.)[oO]", "O_o"}, {"\\>\\;\\(", ">("},
|
||||
{"\\<\\;3", "<3"}, {"\\:-?(o|O)", ":O"},
|
||||
{"\\:-?(p|P)", ":P"}, {"\\:-?[\\\\/]", ":/"},
|
||||
{"\\:-?[z|Z|\\|]", ":Z"}, {"\\:-?\\(", ":("},
|
||||
{"\\:-?\\)", ":)"}, {"\\:-?D", ":D"},
|
||||
{"\\;-?(p|P)", ";P"}, {"\\;-?\\)", ";)"},
|
||||
{"R-?\\)", "R)"}, {"B-?\\)", "B)"},
|
||||
};
|
||||
|
||||
auto it = emoteNameReplacements.find(dirtyEmoteCode.string);
|
||||
if (it != emoteNameReplacements.end())
|
||||
{
|
||||
cleanCode = it.value();
|
||||
}
|
||||
|
||||
cleanCode.replace("<", "<");
|
||||
cleanCode.replace(">", ">");
|
||||
|
||||
return cleanCode;
|
||||
}
|
||||
|
||||
// id is used for lookup
|
||||
// emoteName is used for giving a name to the emote in case it doesn't exist
|
||||
EmotePtr TwitchEmotes::getOrCreateEmote(const EmoteId &id,
|
||||
|
||||
Reference in New Issue
Block a user