mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-27 16:16:35 +03:00
show mutual friends
This commit is contained in:
@@ -599,6 +599,16 @@ void DiscordClient::SetUserNote(Snowflake user_id, std::string note, sigc::slot<
|
||||
});
|
||||
}
|
||||
|
||||
void DiscordClient::FetchUserRelationships(Snowflake user_id, sigc::slot<void(std::vector<UserData>)> callback) {
|
||||
m_http.MakeGET("/users/" + std::to_string(user_id) + "/relationships", [this, callback](const http::response_type &response) {
|
||||
if (!CheckCode(response)) return;
|
||||
RelationshipsData data = nlohmann::json::parse(response.text);
|
||||
for (const auto &user : data.Users)
|
||||
m_store.SetUser(user.ID, user);
|
||||
callback(data.Users);
|
||||
});
|
||||
}
|
||||
|
||||
void DiscordClient::UpdateToken(std::string token) {
|
||||
if (!IsStarted()) {
|
||||
m_token = token;
|
||||
|
||||
@@ -134,6 +134,7 @@ public:
|
||||
void FetchUserNote(Snowflake user_id, sigc::slot<void(std::string note)> callback);
|
||||
void SetUserNote(Snowflake user_id, std::string note);
|
||||
void SetUserNote(Snowflake user_id, std::string note, sigc::slot<void(bool success)> callback);
|
||||
void FetchUserRelationships(Snowflake user_id, sigc::slot<void(std::vector<UserData>)> callback);
|
||||
|
||||
void UpdateToken(std::string token);
|
||||
void SetUserAgent(std::string agent);
|
||||
|
||||
@@ -337,3 +337,7 @@ void from_json(const nlohmann::json &j, UserNoteUpdateMessage &m) {
|
||||
JS_D("note", m.Note);
|
||||
JS_D("id", m.ID);
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &j, RelationshipsData &m) {
|
||||
j.get_to(m.Users);
|
||||
}
|
||||
|
||||
@@ -473,3 +473,9 @@ struct UserNoteUpdateMessage {
|
||||
|
||||
friend void from_json(const nlohmann::json &j, UserNoteUpdateMessage &m);
|
||||
};
|
||||
|
||||
struct RelationshipsData {
|
||||
std::vector<UserData> Users;
|
||||
|
||||
friend void from_json(const nlohmann::json &j, RelationshipsData &m);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user