From 3923acd0dd7adef1710bfa039eb22454d9d551dd Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sun, 24 Jan 2021 22:24:03 -0500 Subject: add viewing audit log --- discord/discord.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'discord/discord.cpp') diff --git a/discord/discord.cpp b/discord/discord.cpp index 75be116..9d1dd04 100644 --- a/discord/discord.cpp +++ b/discord/discord.cpp @@ -553,6 +553,22 @@ void DiscordClient::FetchGuildInvites(Snowflake guild_id, sigc::slot callback) { + sigc::signal signal; + signal.connect(callback); + m_http.MakeGET("/guilds/" + std::to_string(guild_id) + "/audit-logs", [this, callback](const http::response &response) { + if (!CheckCode(response)) return; + auto data = nlohmann::json::parse(response.text).get(); + + m_store.BeginTransaction(); + for (const auto &user : data.Users) + m_store.SetUser(user.ID, user); + m_store.EndTransaction(); + + callback(data); + }); +} + void DiscordClient::UpdateToken(std::string token) { if (!IsStarted()) { m_token = token; -- cgit v1.2.3