Added mod button-like placeholders in right click commands (#3765)

Implemented input.text to return altText when it makes no sense to contain data

Co-authored-by: Kasia <zneix@zneix.eu>
This commit is contained in:
Mm2PL
2022-05-29 12:23:29 +00:00
committed by GitHub
parent 0ad66c0af4
commit c8f5d35042
3 changed files with 40 additions and 10 deletions
+23 -3
View File
@@ -2119,7 +2119,7 @@ void ChannelView::addCommandExecutionContextMenuItems(
inputText.push_front(cmd.name + " ");
cmdMenu->addAction(cmd.name, [this, inputText] {
cmdMenu->addAction(cmd.name, [this, layout, cmd, inputText] {
ChannelPtr channel;
/* Search popups and user message history's underlyingChannels aren't of type TwitchChannel, but
@@ -2132,9 +2132,29 @@ void ChannelView::addCommandExecutionContextMenuItems(
{
channel = this->underlyingChannel_;
}
auto split = dynamic_cast<Split *>(this->parentWidget());
QString userText;
if (split)
{
userText = split->getInput().getInputText();
}
QString value = getApp()->commands->execCustomCommand(
inputText.split(' '), cmd, true, channel,
{
{"user.name", layout->getMessage()->loginName},
{"msg.id", layout->getMessage()->id},
{"msg.text", layout->getMessage()->messageText},
{"input.text", userText},
QString value =
getApp()->commands->execCommand(inputText, channel, false);
// old placeholders
{"user", layout->getMessage()->loginName},
{"msg-id", layout->getMessage()->id},
{"message", layout->getMessage()->messageText},
{"channel", this->channel()->getName()},
});
value = getApp()->commands->execCommand(value, channel, false);
channel->sendMessage(value);
});