Added /copy command (#3763)

Copies the given arguments to clipboard
This commit is contained in:
Kasia
2022-05-23 00:42:52 +02:00
committed by GitHub
parent 77e9a40bb4
commit e11677c62b
2 changed files with 18 additions and 0 deletions
@@ -17,6 +17,7 @@
#include "singletons/Settings.hpp"
#include "singletons/Theme.hpp"
#include "singletons/WindowManager.hpp"
#include "util/Clipboard.hpp"
#include "util/CombinePath.hpp"
#include "util/FormatTime.hpp"
#include "util/Helpers.hpp"
@@ -825,6 +826,7 @@ void CommandController::initialize(Settings &, Paths &paths)
}
return "";
});
this->registerCommand("/setgame", [](const QStringList &words,
const ChannelPtr channel) {
if (words.size() < 2)
@@ -923,6 +925,7 @@ void CommandController::initialize(Settings &, Paths &paths)
return "";
});
this->registerCommand(
"/delete", [](const QStringList &words, ChannelPtr channel) -> QString {
// This is a wrapper over the standard Twitch /delete command
@@ -965,6 +968,7 @@ void CommandController::initialize(Settings &, Paths &paths)
getApp()->twitch->sendRawMessage(words.mid(1).join(" "));
return "";
});
#ifndef NDEBUG
this->registerCommand(
"/fakemsg",
@@ -981,6 +985,19 @@ void CommandController::initialize(Settings &, Paths &paths)
return "";
});
#endif
this->registerCommand(
"/copy", [](const QStringList &words, ChannelPtr channel) -> QString {
if (words.size() < 2)
{
channel->addMessage(
makeSystemMessage("Usage: /copy <text> - copies provided "
"text to clipboard."));
return "";
}
crossPlatformCopy(words.mid(1).join(" "));
return "";
});
}
void CommandController::save()