Replace #define in CommandController with QStringList (#2658)

This commit is contained in:
Paweł 2021-04-25 16:25:37 +02:00 committed by GitHub
parent 08f2773f30
commit daf6ebc513
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,17 +28,43 @@
#include <QFile> #include <QFile>
#include <QRegularExpression> #include <QRegularExpression>
#define TWITCH_DEFAULT_COMMANDS \
"/help", "/w", "/me", "/disconnect", "/mods", "/vips", "/color", \
"/commercial", "/mod", "/unmod", "/vip", "/unvip", "/ban", "/unban", \
"/timeout", "/untimeout", "/slow", "/slowoff", "/r9kbeta", \
"/r9kbetaoff", "/emoteonly", "/emoteonlyoff", "/clear", \
"/subscribers", "/subscribersoff", "/followers", "/followersoff", \
"/host", "/unhost", "/raid", "/unraid"
namespace { namespace {
using namespace chatterino; using namespace chatterino;
static const QStringList twitchDefaultCommands{
"/help",
"/w",
"/me",
"/disconnect",
"/mods",
"/vips",
"/color",
"/commercial",
"/mod",
"/unmod",
"/vip",
"/unvip",
"/ban",
"/unban",
"/timeout",
"/untimeout",
"/slow",
"/slowoff",
"/r9kbeta",
"/r9kbetaoff",
"/emoteonly",
"/emoteonlyoff",
"/clear",
"/subscribers",
"/subscribersoff",
"/followers",
"/followersoff",
"/host",
"/unhost",
"/raid",
"/unraid",
};
static const QStringList whisperCommands{"/w", ".w"}; static const QStringList whisperCommands{"/w", ".w"};
void sendWhisperMessage(const QString &text) void sendWhisperMessage(const QString &text)
@ -177,7 +203,7 @@ namespace chatterino {
void CommandController::initialize(Settings &, Paths &paths) void CommandController::initialize(Settings &, Paths &paths)
{ {
this->commandAutoCompletions_ = QStringList{TWITCH_DEFAULT_COMMANDS}; this->commandAutoCompletions_ = twitchDefaultCommands;
// Update commands map when the vector of commands has been updated // Update commands map when the vector of commands has been updated
auto addFirstMatchToMap = [this](auto args) { auto addFirstMatchToMap = [this](auto args) {