Move ChatSettings commands to their own file (#4116)
* Move ChatSettings commands to their own file * reformat error message strings * move ChatCommands together in CommandController.cpp * Allow CommandContext to be provided for builtin functions using variants MEGADANK * add missing include * rename to ComandFunctionVariants also include some move magic & const reffing
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "common/SignalVector.hpp"
|
||||
#include "common/Singleton.hpp"
|
||||
#include "controllers/commands/Command.hpp"
|
||||
#include "controllers/commands/CommandContext.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
|
||||
#include <QMap>
|
||||
@@ -12,6 +13,7 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
#include <variant>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -46,10 +48,16 @@ private:
|
||||
using CommandFunction =
|
||||
std::function<QString(QStringList /*words*/, ChannelPtr /*channel*/)>;
|
||||
|
||||
void registerCommand(QString commandName, CommandFunction commandFunction);
|
||||
using CommandFunctionWithContext = std::function<QString(CommandContext)>;
|
||||
|
||||
using CommandFunctionVariants =
|
||||
std::variant<CommandFunction, CommandFunctionWithContext>;
|
||||
|
||||
void registerCommand(const QString &commandName,
|
||||
CommandFunctionVariants commandFunction);
|
||||
|
||||
// Chatterino commands
|
||||
QMap<QString, CommandFunction> commands_;
|
||||
std::unordered_map<QString, CommandFunctionVariants> commands_;
|
||||
|
||||
// User-created commands
|
||||
QMap<QString, Command> userCommands_;
|
||||
|
||||
Reference in New Issue
Block a user