From c44e7295dac88606ed30c9d43c1690eae622fbf6 Mon Sep 17 00:00:00 2001 From: iProdigy <8106344+iProdigy@users.noreply.github.com> Date: Sat, 15 Apr 2023 03:13:26 -0700 Subject: [PATCH] feat: add /lowtrust command (#4542) Co-authored-by: pajlada --- CHANGELOG.md | 1 + .../commands/CommandController.cpp | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b63d780e9..fd24b974c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Minor: Added better filter validation and error messages. (#4364) - Minor: Updated the look of the Black Theme to be more in line with the other themes. (#4523) - Minor: Reply context now censors blocked users. (#4502) +- Minor: Added `/lowtrust` command to open the suspicious user activity feed in browser. (#4542) - Bugfix: Fixed an issue where animated emotes would render on top of zero-width emotes. (#4314) - Bugfix: Fixed an issue where it was difficult to hover a zero-width emote. (#4314) - Bugfix: Fixed an issue where context-menu items for zero-width emotes displayed the wrong provider. (#4460) diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index ae1ce9093..01abcc26f 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -952,6 +952,36 @@ void CommandController::initialize(Settings &, Paths &paths) return ""; }); + this->registerCommand("/lowtrust", [](const QStringList &words, + ChannelPtr channel) { + QString target(words.value(1)); + + if (target.isEmpty()) + { + if (channel->getType() == Channel::Type::Twitch && + !channel->isEmpty()) + { + target = channel->getName(); + } + else + { + channel->addMessage(makeSystemMessage( + "Usage: /lowtrust [channel]. You can also use the command " + "without arguments in any Twitch channel to open its " + "suspicious user activity feed. Only the broadcaster and " + "moderators have permission to view this feed.")); + return ""; + } + } + + stripChannelName(target); + QDesktopServices::openUrl(QUrl( + QString("https://www.twitch.tv/popout/moderator/%1/low-trust-users") + .arg(target))); + + return ""; + }); + auto formatChattersError = [](HelixGetChattersError error, QString message) { using Error = HelixGetChattersError;