Added /requests command. Usage: /requests [channel]. (#3746)

Opens the channel points requests queue for the provided channel or the current channel if no input is provided.

Co-authored-by: Mm2PL <mm2pl+gh@kotmisia.pl>
This commit is contained in:
badoge
2022-05-22 15:53:45 +04:00
committed by GitHub
parent 1b3aa343a3
commit bd3d2ed82a
3 changed files with 32 additions and 0 deletions
@@ -548,6 +548,36 @@ void CommandController::initialize(Settings &, Paths &paths)
return "";
});
this->registerCommand("/requests", [](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: /requests [channel]. You can also use the command "
"without arguments in any Twitch channel to open its "
"channel points requests queue. Only the broadcaster and "
"moderators have permission to view the queue."));
return "";
}
}
stripChannelName(target);
QDesktopServices::openUrl(
QUrl(QString("https://www.twitch.tv/popout/%1/reward-queue")
.arg(target)));
return "";
});
this->registerCommand(
"/chatters", [](const auto & /*words*/, auto channel) {
auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());