From 9dd83b040b53677f63f83ddbe2a35c228cb477ac Mon Sep 17 00:00:00 2001 From: iProdigy <8106344+iProdigy@users.noreply.github.com> Date: Sun, 5 Nov 2023 07:30:15 -0800 Subject: [PATCH] feat: `/reply` command now replies to the latest message of the user (#4919) Co-authored-by: Rasmus Karlsson --- CHANGELOG.md | 1 + src/controllers/commands/CommandController.cpp | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 461bfd8e5..bf0025c11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Minor: The account switcher is now styled to match your theme. (#4817) - Minor: Add an invisible resize handle to the bottom of frameless user info popups and reply thread popups. (#4795) - Minor: The installer now checks for the VC Runtime version and shows more info when it's outdated. (#4847) +- Minor: The `/reply` command now replies to the latest message of the user. (#4919) - Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840) - Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848) - Bugfix: Trimmed custom streamlink paths on all platforms making sure you don't accidentally add spaces at the beginning or end of its path. (#4834) diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 1c3cce54e..2e38431af 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -1564,20 +1564,16 @@ void CommandController::initialize(Settings &, Paths &paths) const auto &msg = *it; if (msg->loginName.compare(username, Qt::CaseInsensitive) == 0) { - std::shared_ptr thread; // found most recent message by user if (msg->replyThread == nullptr) { - thread = std::make_shared(msg); + // prepare thread if one does not exist + auto thread = std::make_shared(msg); twitchChannel->addReplyThread(thread); } - else - { - thread = msg->replyThread; - } QString reply = words.mid(2).join(" "); - twitchChannel->sendReply(reply, thread->rootId()); + twitchChannel->sendReply(reply, msg->id); return ""; } }