mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
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:
parent
108b733679
commit
88a487516a
2 changed files with 34 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
QString target(words.size() < 2 ? channel->getName() : words[1]);
|
||||
|
||||
if (words.size() < 2 &&
|
||||
(!channel->isTwitchChannel() || channel->isEmpty()))
|
||||
{
|
||||
if (!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());
|
||||
}
|
||||
channel->addMessage(makeSystemMessage(
|
||||
"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 "";
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue