feat: add /lowtrust command (#4542)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
iProdigy 2023-04-15 03:13:26 -07:00 committed by GitHub
parent 782684e41a
commit c44e7295da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View file

@ -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)

View file

@ -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;