refactor: simplify uses of getMessageSnapshot (#6607)

Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2025-11-29 12:40:06 +01:00
committed by GitHub
parent 6756374b5b
commit 041674b7f6
9 changed files with 31 additions and 28 deletions
@@ -6,6 +6,8 @@
#include "providers/twitch/TwitchChannel.hpp"
#include "util/Twitch.hpp"
#include <ranges>
namespace chatterino::commands {
QString sendReply(const CommandContext &ctx)
@@ -32,9 +34,8 @@ QString sendReply(const CommandContext &ctx)
stripChannelName(username);
auto snapshot = ctx.twitchChannel->getMessageSnapshot();
for (auto it = snapshot.rbegin(); it != snapshot.rend(); ++it)
for (const auto &msg : snapshot | std::views::reverse)
{
const auto &msg = *it;
if (msg->loginName.compare(username, Qt::CaseInsensitive) == 0)
{
// found most recent message by user