merge store

This commit is contained in:
ouwou
2021-11-20 18:48:15 -05:00
13 changed files with 2007 additions and 1210 deletions

View File

@@ -192,8 +192,11 @@ std::vector<RoleData> GuildData::FetchRoles() const {
if (!Roles.has_value()) return {};
std::vector<RoleData> ret;
ret.reserve(Roles->size());
for (const auto &thing : *Roles)
ret.push_back(*Abaddon::Get().GetDiscordClient().GetRole(thing.ID));
for (const auto thing : *Roles) {
auto r = Abaddon::Get().GetDiscordClient().GetRole(thing.ID);
if (r.has_value())
ret.push_back(*r);
}
std::sort(ret.begin(), ret.end(), [](const RoleData &a, const RoleData &b) -> bool {
return a.Position > b.Position;
});