Add chat popout command (#2812)

Co-authored-by: Paweł <zneix@zneix.eu>
Co-authored-by: Leon Richardt <leon.richardt@gmail.com>
Co-authored-by: lyx0 <stefan.parfuss@protonmail.ch>
Co-authored-by: lyx0 <66651385+lyx0@users.noreply.github.com>
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Paweł 2021-05-24 00:24:49 +02:00 committed by GitHub
parent 108b733679
commit 88a487516a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 17 deletions

View file

@ -5,6 +5,7 @@
- Minor: Added moderation buttons to search popup when searching in a split with moderation mode enabled. (#2148, #2803)
- Minor: Made "#channel" in `/mentions` tab show in usercards and in the search popup. (#2802)
- Minor: Added settings to disable custom FrankerFaceZ VIP/mod badges. (#2693, #2759)
- Minor: Added `/popout` command. Usage: `/popout [channel]`. It opens browser chat for the provided channel. Can also be used without arguments to open current channels browser chat. (#2556, #2812)
- Bugfix: Fixed FFZ emote links for global emotes (#2807, #2808)
## 2.3.2

View file

@ -25,8 +25,10 @@
#include "widgets/splits/Split.hpp"
#include <QApplication>
#include <QDesktopServices>
#include <QFile>
#include <QRegularExpression>
#include <QUrl>
namespace {
using namespace chatterino;
@ -639,28 +641,42 @@ void CommandController::initialize(Settings &, Paths &paths)
this->registerCommand(
"/streamlink", [](const QStringList &words, ChannelPtr channel) {
if (words.size() < 2)
{
if (!channel->isTwitchChannel() || channel->isEmpty())
QString target(words.size() < 2 ? channel->getName() : words[1]);
if (words.size() < 2 &&
(!channel->isTwitchChannel() || channel->isEmpty()))
{
channel->addMessage(makeSystemMessage(
"Usage: /streamlink <channel>. You can also use the "
"command without arguments in any twitch channel to "
"open it in streamlink."));
}
else
{
channel->addMessage(
makeSystemMessage(QString("Opening %1 in streamlink...")
.arg(channel->getName())));
openStreamlinkForChannel(channel->getName());
}
"Usage: /streamlink [channel]. You can also use the "
"command without arguments in any Twitch channel to open "
"it in streamlink."));
return "";
}
channel->addMessage(makeSystemMessage(
QString("Opening %1 in streamlink...").arg(words[1])));
openStreamlinkForChannel(words[1]);
QString("Opening %1 in streamlink...").arg(target)));
openStreamlinkForChannel(target);
return "";
});
this->registerCommand(
"/popout", [](const QStringList &words, ChannelPtr channel) {
QString target(words.size() < 2 ? channel->getName() : words[1]);
if (words.size() < 2 &&
(!channel->isTwitchChannel() || channel->isEmpty()))
{
channel->addMessage(makeSystemMessage(
"Usage: /popout [channel]. You can also use the command "
"without arguments in any Twitch channel to open its "
"popout chat."));
return "";
}
QDesktopServices::openUrl(
QUrl(QString("https://www.twitch.tv/popout/%1/chat?popout=")
.arg(target)));
return "";
});