mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-13 20:18:50 +03:00
pretend to be a real client a little better
This commit is contained in:
@@ -15,6 +15,7 @@ void from_json(const nlohmann::json &j, Channel &m) {
|
||||
JS_O("user_limit", m.UserLimit);
|
||||
JS_O("rate_limit_per_user", m.RateLimitPerUser);
|
||||
JS_O("recipients", m.Recipients);
|
||||
JS_O("recipient_ids", m.RecipientIDs);
|
||||
JS_ON("icon", m.Icon);
|
||||
JS_O("owner_id", m.OwnerID);
|
||||
JS_O("application_id", m.ApplicationID);
|
||||
@@ -45,3 +46,22 @@ void Channel::update_from_json(const nlohmann::json &j) {
|
||||
std::optional<PermissionOverwrite> Channel::GetOverwrite(Snowflake id) const {
|
||||
return Abaddon::Get().GetDiscordClient().GetPermissionOverwrite(ID, id);
|
||||
}
|
||||
|
||||
std::vector<User> Channel::GetDMRecipients() const {
|
||||
const auto &discord = Abaddon::Get().GetDiscordClient();
|
||||
if (Recipients.has_value())
|
||||
return *Recipients;
|
||||
|
||||
if (RecipientIDs.has_value()) {
|
||||
std::vector<User> ret;
|
||||
for (const auto &id : *RecipientIDs) {
|
||||
auto user = discord.GetUser(id);
|
||||
if (user.has_value())
|
||||
ret.push_back(std::move(*user));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return std::vector<User>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user