Allow for usage of builtin Chatterino commands in custom commands. (#2632)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -769,6 +769,25 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
||||
|
||||
auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
|
||||
|
||||
{
|
||||
// check if user command exists
|
||||
const auto it = this->userCommands_.find(commandName);
|
||||
if (it != this->userCommands_.end())
|
||||
{
|
||||
text = getApp()->emotes->emojis.replaceShortCodes(
|
||||
this->execCustomCommand(words, it.value(), dryRun));
|
||||
|
||||
words = text.split(' ', QString::SkipEmptyParts);
|
||||
|
||||
if (words.length() == 0)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
commandName = words[0];
|
||||
}
|
||||
}
|
||||
|
||||
// works only in a valid twitch channel
|
||||
if (!dryRun && twitchChannel != nullptr)
|
||||
{
|
||||
@@ -780,15 +799,6 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// check if user command exists
|
||||
const auto it = this->userCommands_.find(commandName);
|
||||
if (it != this->userCommands_.end())
|
||||
{
|
||||
return this->execCustomCommand(words, it.value(), dryRun);
|
||||
}
|
||||
}
|
||||
|
||||
auto maxSpaces = std::min(this->maxSpaces_, words.length() - 1);
|
||||
for (int i = 0; i < maxSpaces; ++i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user