diff options
| author | ilotterytea <iltsu@alright.party> | 2024-12-07 17:24:25 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-12-07 17:24:25 +0500 |
| commit | 52fd4ea8bad5cd7d3940a41df4f8f54b4e72beae (patch) | |
| tree | 28f13892e7da8ec023f4b4d1113bef88795724ca /bot/src/modules/help.hpp | |
| parent | e604d12282b8fa9f9023bb79161b36c9a8b0be55 (diff) | |
feat: a special class for command responses
Diffstat (limited to 'bot/src/modules/help.hpp')
| -rw-r--r-- | bot/src/modules/help.hpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/bot/src/modules/help.hpp b/bot/src/modules/help.hpp index 13af228..1341b86 100644 --- a/bot/src/modules/help.hpp +++ b/bot/src/modules/help.hpp @@ -1,7 +1,6 @@ #pragma once #include <string> -#include <variant> #include <vector> #include "../bundle.hpp" @@ -13,18 +12,18 @@ namespace bot { class Help : public command::Command { std::string get_name() const override { return "help"; } - std::variant<std::vector<std::string>, std::string> run( - const InstanceBundle &bundle, - const command::Request &request) const override { + command::Response run(const InstanceBundle &bundle, + const command::Request &request) const override { if (!bundle.configuration.url.help.has_value()) { throw ResponseException<ResponseError::ILLEGAL_COMMAND>( request, bundle.localization); } - return bundle.localization - .get_formatted_line(request, loc::LineId::HelpResponse, - {*bundle.configuration.url.help}) - .value(); + return command::Response( + bundle.localization + .get_formatted_line(request, loc::LineId::HelpResponse, + {*bundle.configuration.url.help}) + .value()); } }; } |
