summaryrefslogtreecommitdiff
path: root/discord/discord.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r--discord/discord.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp
index 0055229..5f356f2 100644
--- a/discord/discord.cpp
+++ b/discord/discord.cpp
@@ -522,6 +522,12 @@ void DiscordClient::DeleteInvite(const std::string &code, sigc::slot<void(bool s
});
}
+void DiscordClient::AddGroupDMRecipient(Snowflake channel_id, Snowflake user_id) {
+ m_http.MakePUT("/channels/" + std::to_string(channel_id) + "/recipients/" + std::to_string(user_id), "", [this](const http::response_type &response) {
+ CheckCode(response);
+ });
+}
+
void DiscordClient::RemoveGroupDMRecipient(Snowflake channel_id, Snowflake user_id) {
m_http.MakeDELETE("/channels/" + std::to_string(channel_id) + "/recipients/" + std::to_string(user_id), [this](const http::response_type &response) {
CheckCode(response);
@@ -645,6 +651,14 @@ std::optional<PresenceStatus> DiscordClient::GetUserStatus(Snowflake id) const {
return std::nullopt;
}
+std::unordered_set<Snowflake> DiscordClient::GetRelationships(RelationshipType type) const {
+ std::unordered_set<Snowflake> ret;
+ for (const auto &[id, rtype] : m_user_relationships)
+ if (rtype == type)
+ ret.insert(id);
+ return ret;
+}
+
void DiscordClient::HandleGatewayMessageRaw(std::string str) {
// handles multiple zlib compressed messages, calling HandleGatewayMessage when a full message is received
std::vector<uint8_t> buf(str.begin(), str.end());
@@ -890,6 +904,10 @@ void DiscordClient::HandleGatewayReady(const GatewayMessage &msg) {
}
}
+ if (data.Relationships.has_value())
+ for (const auto &relationship : *data.Relationships)
+ m_user_relationships[relationship.ID] = relationship.Type;
+
m_store.EndTransaction();
m_session_id = data.SessionID;