bug fix moment

This commit is contained in:
ouwou 2020-11-08 20:52:29 -05:00
parent 67ee799f04
commit 9fa59479aa
4 changed files with 9 additions and 6 deletions

View File

@ -24,9 +24,13 @@ bool Snowflake::IsValid() const {
}
void from_json(const nlohmann::json &j, Snowflake &s) {
std::string tmp;
j.get_to(tmp);
s.m_num = std::stoull(tmp);
if (j.is_string()) {
std::string tmp;
j.get_to(tmp);
s.m_num = std::stoull(tmp);
} else {
j.get_to(s.m_num);
}
}
void to_json(nlohmann::json &j, const Snowflake &s) {

View File

@ -5,7 +5,6 @@ void from_json(const nlohmann::json &j, UserSettingsGuildFoldersEntry &m) {
JS_D("guild_ids", m.GuildIDs);
JS_N("id", m.ID);
JS_N("name", m.Name);
}
void from_json(const nlohmann::json &j, UserSettings &m) {

View File

@ -6,7 +6,7 @@
struct UserSettingsGuildFoldersEntry {
int Color = -1; // null
std::vector<Snowflake> GuildIDs;
int ID = -1; // null
Snowflake ID; // null (this can be a snowflake as a string or an int that isnt a snowflake lol)
std::string Name; // null
friend void from_json(const nlohmann::json &j, UserSettingsGuildFoldersEntry &m);

View File

@ -23,7 +23,7 @@ int SettingsManager::GetSettingInt(const std::string &section, const std::string
}
bool SettingsManager::GetSettingBool(const std::string &section, const std::string &key, bool fallback) const {
return GetSettingString(section, key, "false") != "false";
return GetSettingString(section, key, fallback ? "true" : "false") != "false";
}
bool SettingsManager::IsValid() const {