store stage instances on connect

This commit is contained in:
ouwou 2024-04-15 20:28:11 -04:00
parent 02fd49b073
commit 870f05062a
3 changed files with 10 additions and 0 deletions

View File

@ -1720,6 +1720,13 @@ void DiscordClient::ProcessNewGuild(GuildData &guild) {
return;
}
if (guild.StageInstances.has_value()) {
for (const auto &stage : *guild.StageInstances) {
m_stage_instances[stage.ID] = stage;
m_channel_to_stage_instance[stage.ChannelID] = stage.ID;
}
}
m_store.BeginTransaction();
m_store.SetGuild(guild.ID, guild);

View File

@ -54,6 +54,7 @@ void from_json(const nlohmann::json &j, GuildData &m) {
JS_O("preferred_locale", m.PreferredLocale);
JS_ON("public_updates_channel_id", m.PublicUpdatesChannelID);
JS_O("max_video_channel_users", m.MaxVideoChannelUsers);
JS_ON("stage_instances", m.StageInstances);
JS_O("approximate_member_count", tmp);
if (tmp.has_value())
m.ApproximateMemberCount = std::stol(*tmp);

View File

@ -4,6 +4,7 @@
#include "role.hpp"
#include "channel.hpp"
#include "emoji.hpp"
#include "stage.hpp"
#include <vector>
#include <string>
#include <unordered_set>
@ -90,6 +91,7 @@ struct GuildData {
std::optional<int> ApproximateMemberCount;
std::optional<int> ApproximatePresenceCount;
std::optional<std::vector<ChannelData>> Threads; // only with permissions to view, id only
std::optional<std::vector<StageInstance>> StageInstances;
// undocumented
// std::map<std::string, Unknown> GuildHashes;