From fcb094463b410952b0905af41707787e1791bbac Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 23 Aug 2021 02:48:56 -0400 Subject: [PATCH] fix RateLimitIndicator picking up updates from other channels --- components/ratelimitindicator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/ratelimitindicator.cpp b/components/ratelimitindicator.cpp index 6115900..708ab34 100644 --- a/components/ratelimitindicator.cpp +++ b/components/ratelimitindicator.cpp @@ -124,7 +124,10 @@ void RateLimitIndicator::OnMessageSendFail(const std::string &nonce, float retry } void RateLimitIndicator::OnChannelUpdate(Snowflake channel_id) { - const auto r = Abaddon::Get().GetDiscordClient().GetChannel(channel_id)->RateLimitPerUser; + if (channel_id != m_active_channel) return; + const auto chan = Abaddon::Get().GetDiscordClient().GetChannel(m_active_channel); + if (!chan.has_value()) return; + const auto r = chan->RateLimitPerUser; if (r.has_value()) m_rate_limit = *r; else