fix some reaction stuff

This commit is contained in:
ouwou
2020-12-15 02:45:37 -05:00
parent 2667a4b30d
commit 315a4a8df8
4 changed files with 38 additions and 12 deletions

View File

@@ -328,11 +328,17 @@ std::optional<Emoji> Store::GetEmoji(Snowflake id) const {
Emoji ret;
ret.ID = id;
Get(m_get_emote_stmt, 1, ret.Name);
std::string tmp;
Get(m_get_emote_stmt, 2, tmp);
ret.Roles = nlohmann::json::parse(tmp).get<std::vector<Snowflake>>();
ret.Creator = std::optional<User>(User());
Get(m_get_emote_stmt, 3, ret.Creator->ID);
if (!IsNull(m_get_emote_stmt, 2)) {
std::string tmp;
Get(m_get_emote_stmt, 2, tmp);
ret.Roles = nlohmann::json::parse(tmp).get<std::vector<Snowflake>>();
}
if (!IsNull(m_get_emote_stmt, 3)) {
ret.Creator = std::optional<User>(User());
Get(m_get_emote_stmt, 3, ret.Creator->ID);
}
Get(m_get_emote_stmt, 3, ret.NeedsColons);
Get(m_get_emote_stmt, 4, ret.IsManaged);
Get(m_get_emote_stmt, 5, ret.IsAnimated);