Add new command placeholders: {channel.name}, {channel.id}, {stream.game}, {stream.title}, {my.id}, {my.name} (#3155)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -2101,12 +2101,24 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
|
||||
}
|
||||
}
|
||||
|
||||
value.replace("{user}", layout->getMessage()->loginName)
|
||||
.replace("{channel}", this->channel_->getName())
|
||||
.replace("{msg-id}", layout->getMessage()->id)
|
||||
.replace("{message}", layout->getMessage()->messageText);
|
||||
value = getApp()->commands->execCustomCommand(
|
||||
QStringList(), Command{"(modaction)", value}, true, channel,
|
||||
{
|
||||
{"user.name", layout->getMessage()->loginName},
|
||||
{"msg.id", layout->getMessage()->id},
|
||||
{"msg.text", layout->getMessage()->messageText},
|
||||
|
||||
// old placeholders
|
||||
{"user", layout->getMessage()->loginName},
|
||||
{"msg-id", layout->getMessage()->id},
|
||||
{"message", layout->getMessage()->messageText},
|
||||
|
||||
// new version of this is inside execCustomCommand
|
||||
{"channel", this->channel()->getName()},
|
||||
});
|
||||
|
||||
value = getApp()->commands->execCommand(value, channel, false);
|
||||
|
||||
channel->sendMessage(value);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -157,8 +157,8 @@ ModerationPage::ModerationPage()
|
||||
// clang-format off
|
||||
auto label = modMode.emplace<QLabel>(
|
||||
"Moderation mode is enabled by clicking <img width='18' height='18' src=':/buttons/modModeDisabled.png'> in a channel that you moderate.<br><br>"
|
||||
"Moderation buttons can be bound to chat commands such as \"/ban {user}\", \"/timeout {user} 1000\", \"/w someusername !report {user} was bad in channel {channel}\" or any other custom text commands.<br>"
|
||||
"For deleting messages use /delete {msg-id}.<br><br>"
|
||||
"Moderation buttons can be bound to chat commands such as \"/ban {user.name}\", \"/timeout {user.name} 1000\", \"/w someusername !report {user.name} was bad in channel {channel.name}\" or any other custom text commands.<br>"
|
||||
"For deleting messages use /delete {msg.id}.<br><br>"
|
||||
"More information can be found <a href='https://wiki.chatterino.com/Moderation/#moderation-mode'>here</a>.");
|
||||
label->setOpenExternalLinks(true);
|
||||
label->setWordWrap(true);
|
||||
@@ -188,7 +188,7 @@ ModerationPage::ModerationPage()
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
getSettings()->moderationActions.append(
|
||||
ModerationAction("/timeout {user} 300"));
|
||||
ModerationAction("/timeout {user.name} 300"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user