send channel lazy load when loading thread if not previously sent

This commit is contained in:
ouwou
2021-09-01 22:22:08 -04:00
parent 66747ec753
commit 07e30b9acd
2 changed files with 8 additions and 0 deletions

View File

@@ -476,9 +476,16 @@ void DiscordClient::SendLazyLoad(Snowflake id) {
msg.ShouldGetThreads = true;
m_websocket.Send(msg);
m_channels_lazy_loaded.insert(id);
}
void DiscordClient::SendThreadLazyLoad(Snowflake id) {
auto thread = GetChannel(id);
if (thread.has_value())
if (m_channels_lazy_loaded.find(*thread->ParentID) == m_channels_lazy_loaded.end())
SendLazyLoad(*thread->ParentID);
LazyLoadRequestMessage msg;
msg.GuildID = *GetChannel(id)->GuildID;
msg.ThreadIDs.emplace().push_back(id);

View File

@@ -310,6 +310,7 @@ private:
std::queue<std::function<void()>> m_generic_queue;
std::set<Snowflake> m_channels_pinned_requested;
std::set<Snowflake> m_channels_lazy_loaded;
// signals
public: