mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Allow for usage of builtin Chatterino commands in custom commands. (#2632)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
8641435142
commit
3ee23b2bae
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## Unversioned
|
## Unversioned
|
||||||
|
|
||||||
|
- Minor: Allow for built-in Chatterino commands to be used in custom commands. (#2632)
|
||||||
- Bugfix: Fix crash that could occur when the user changed the "Custom stream player URI Scheme" setting if the user had closed down and splits in the application runtime. (#2592)
|
- Bugfix: Fix crash that could occur when the user changed the "Custom stream player URI Scheme" setting if the user had closed down and splits in the application runtime. (#2592)
|
||||||
|
|
||||||
## 2.3.0
|
## 2.3.0
|
||||||
|
|
|
@ -769,6 +769,25 @@ QString CommandController::execCommand(const QString &textNoEmoji,
|
||||||
|
|
||||||
auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
|
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
|
// works only in a valid twitch channel
|
||||||
if (!dryRun && twitchChannel != nullptr)
|
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);
|
auto maxSpaces = std::min(this->maxSpaces_, words.length() - 1);
|
||||||
for (int i = 0; i < maxSpaces; ++i)
|
for (int i = 0; i < maxSpaces; ++i)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue