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/chatters.hpp | |
| parent | e604d12282b8fa9f9023bb79161b36c9a8b0be55 (diff) | |
feat: a special class for command responses
Diffstat (limited to 'bot/src/modules/chatters.hpp')
| -rw-r--r-- | bot/src/modules/chatters.hpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/bot/src/modules/chatters.hpp b/bot/src/modules/chatters.hpp index fe921ab..6e4c61c 100644 --- a/bot/src/modules/chatters.hpp +++ b/bot/src/modules/chatters.hpp @@ -4,7 +4,6 @@ #include <iomanip> #include <sstream> #include <string> -#include <variant> #include <vector> #include "../bundle.hpp" @@ -25,9 +24,8 @@ namespace bot::mod { int get_delay_seconds() const override { return 10; } - 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.paste_service.has_value()) { throw ResponseException<ResponseError::ILLEGAL_COMMAND>( request, bundle.localization); @@ -65,9 +63,11 @@ namespace bot::mod { std::string url = *bundle.configuration.url.paste_service + "/" + id; - return bundle.localization - .get_formatted_line(request, loc::LineId::ChattersResponse, {url}) - .value(); + return command::Response( + bundle.localization + .get_formatted_line(request, loc::LineId::ChattersResponse, + {url}) + .value()); } else { throw ResponseException<ResponseError::EXTERNAL_API_ERROR>( request, bundle.localization, response.status_code, |
