summaryrefslogtreecommitdiff
path: root/src/discord
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2024-04-23 22:14:14 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2024-04-23 22:14:14 -0400
commit3dc8fa8e65bdd1bd45dfa0171a06dfbb448baf0d (patch)
treee09e1024813314cc197156bdb80522948e726afa /src/discord
parent870f05062a87444ee58436e8d12ba3702073eb8e (diff)
downloadabaddon-portaudio-3dc8fa8e65bdd1bd45dfa0171a06dfbb448baf0d.tar.gz
abaddon-portaudio-3dc8fa8e65bdd1bd45dfa0171a06dfbb448baf0d.zip
show thingy topic right away
Diffstat (limited to 'src/discord')
-rw-r--r--src/discord/discord.cpp9
-rw-r--r--src/discord/discord.hpp1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp
index b3f8ca6..c54583a 100644
--- a/src/discord/discord.cpp
+++ b/src/discord/discord.cpp
@@ -358,6 +358,14 @@ std::optional<WebhookMessageData> DiscordClient::GetWebhookMessageData(Snowflake
return m_store.GetWebhookMessage(message_id);
}
+std::optional<StageInstance> DiscordClient::GetStageInstanceFromChannel(Snowflake channel_id) const {
+ const auto iter1 = m_channel_to_stage_instance.find(channel_id);
+ if (iter1 == m_channel_to_stage_instance.end()) return {};
+ const auto iter2 = m_stage_instances.find(iter1->second);
+ if (iter2 == m_stage_instances.end()) return {};
+ return iter2->second;
+}
+
bool DiscordClient::IsThreadJoined(Snowflake thread_id) const {
return std::find(m_joined_threads.begin(), m_joined_threads.end(), thread_id) != m_joined_threads.end();
}
@@ -1722,6 +1730,7 @@ void DiscordClient::ProcessNewGuild(GuildData &guild) {
if (guild.StageInstances.has_value()) {
for (const auto &stage : *guild.StageInstances) {
+ spdlog::get("discord")->debug("storing stage {} in channel {}", stage.ID, stage.ChannelID);
m_stage_instances[stage.ID] = stage;
m_channel_to_stage_instance[stage.ChannelID] = stage.ID;
}
diff --git a/src/discord/discord.hpp b/src/discord/discord.hpp
index 44a7328..eca25a6 100644
--- a/src/discord/discord.hpp
+++ b/src/discord/discord.hpp
@@ -65,6 +65,7 @@ public:
void GetArchivedPrivateThreads(Snowflake channel_id, const sigc::slot<void(DiscordError, const ArchivedThreadsResponseData &)> &callback);
std::vector<Snowflake> GetChildChannelIDs(Snowflake parent_id) const;
std::optional<WebhookMessageData> GetWebhookMessageData(Snowflake message_id) const;
+ std::optional<StageInstance> GetStageInstanceFromChannel(Snowflake channel_id) const;
// get ids of given list of members for who we do not have the member data
template<typename Iter>