From 52fd4ea8bad5cd7d3940a41df4f8f54b4e72beae Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 7 Dec 2024 17:24:25 +0500 Subject: feat: a special class for command responses --- bot/src/modules/help.hpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'bot/src/modules/help.hpp') 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 -#include #include #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::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( 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()); } }; } -- cgit v1.2.3