mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-19 20:11:59 +03:00
join guild -> accept invite, handle group dm invites
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
#include "invite.hpp"
|
||||
|
||||
void from_json(const nlohmann::json &j, InviteChannelData &m) {
|
||||
JS_D("id", m.ID);
|
||||
JS_D("type", m.Type);
|
||||
JS_ON("name", m.Name);
|
||||
if (j.contains("recipients") && j.at("recipients").is_null()) {
|
||||
m.RecipientUsernames.emplace();
|
||||
for (const auto &x : j.at("recipients"))
|
||||
m.RecipientUsernames->push_back(x.at("username").get<std::string>());
|
||||
}
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &j, InviteData &m) {
|
||||
JS_D("code", m.Code);
|
||||
JS_O("guild", m.Guild);
|
||||
@@ -15,3 +26,14 @@ void from_json(const nlohmann::json &j, InviteData &m) {
|
||||
JS_O("temporary", m.IsTemporary);
|
||||
JS_O("created_at", m.CreatedAt);
|
||||
}
|
||||
|
||||
InviteChannelData::InviteChannelData(const ChannelData &c) {
|
||||
ID = c.ID;
|
||||
Type = c.Type;
|
||||
Name = c.Name;
|
||||
if (Type == ChannelType::GROUP_DM) {
|
||||
RecipientUsernames.emplace();
|
||||
for (const auto &r : c.GetDMRecipients())
|
||||
RecipientUsernames->push_back(r.Username);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user