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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View file

@ -16,6 +16,7 @@
- Minor: Fixed automod caught message notice appearing twice for mods. (#3717)
- Minor: Added `/requests` command. Usage: `/requests [channel]`. Opens the channel points requests queue for the provided channel or the current channel if no input is provided. (#3746)
- Minor: Added ability to execute commands on chat messages using the message context menu. (#3738)
- Minor: Added `/copy` command. Usage: `/copy <text>`. Copies provided text to clipboard - can be useful with custom commands. (#3763)
- Bugfix: Fixed live notifications for usernames containing uppercase characters. (#3646)
- Bugfix: Fixed live notifications not getting updated for closed streams going offline. (#3678)
- Bugfix: Fixed certain settings dialogs appearing behind the main window, when `Always on top` was used. (#3679)

View file

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