added completion for default twitch commands

This commit is contained in:
fourtf 2018-06-24 13:56:56 +02:00
parent e1f2cb3355
commit 9a719dcd05
3 changed files with 21 additions and 0 deletions

View file

@ -15,6 +15,14 @@
#include <QFile> #include <QFile>
#include <QRegularExpression> #include <QRegularExpression>
#define TWITCH_DEFAULT_COMMANDS \
{ \
"/help", "/w", "/me", "/disconnect", "/mods", "/color", "/ban", "/unban", "/timeout", \
"/untimeout", "/slow", "/slowoff", "/r9kbeta", "/r9kbetaoff", "/emoteonly", \
"/emoteonlyoff", "/clear", "/subscribers", "/subscribersoff", "/followers", \
"/followersoff" \
}
using namespace chatterino::providers::twitch; using namespace chatterino::providers::twitch;
namespace chatterino { namespace chatterino {
@ -274,6 +282,14 @@ QString CommandController::execCustomCommand(const QStringList &words, const Com
return result.replace("{{", "{"); return result.replace("{{", "{");
} }
QStringList CommandController::getDefaultTwitchCommandList()
{
QStringList l = TWITCH_DEFAULT_COMMANDS;
l += "/uptime";
return l;
}
} // namespace commands } // namespace commands
} // namespace controllers } // namespace controllers
} // namespace chatterino } // namespace chatterino

View file

@ -21,6 +21,7 @@ public:
CommandController(); CommandController();
QString execCommand(const QString &text, std::shared_ptr<Channel> channel, bool dryRun); QString execCommand(const QString &text, std::shared_ptr<Channel> channel, bool dryRun);
QStringList getDefaultTwitchCommandList();
void load(); void load();
void save(); void save();

View file

@ -69,6 +69,10 @@ void CompletionModel::refresh()
this->addString(command.name, TaggedString::Command); this->addString(command.name, TaggedString::Command);
} }
for (auto &command : app->commands->getDefaultTwitchCommandList()) {
this->addString(command, TaggedString::Command);
}
// Channel-specific: Usernames // Channel-specific: Usernames
// fourtf: only works with twitch chat // fourtf: only works with twitch chat
// auto c = singletons::ChannelManager::getInstance().getTwitchChannel(this->channelName); // auto c = singletons::ChannelManager::getInstance().getTwitchChannel(this->channelName);