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/ping.hpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'bot/src/modules/ping.hpp') diff --git a/bot/src/modules/ping.hpp b/bot/src/modules/ping.hpp index 836917d..cc982f6 100644 --- a/bot/src/modules/ping.hpp +++ b/bot/src/modules/ping.hpp @@ -6,7 +6,6 @@ #include #include -#include #include #include "../bundle.hpp" @@ -18,9 +17,8 @@ namespace bot { class Ping : public command::Command { std::string get_name() const override { return "ping"; } - 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 { auto now = std::chrono::steady_clock::now(); auto duration = now - START_TIME; auto seconds = @@ -48,11 +46,12 @@ namespace bot { cpp_info.append(" ยท "); } - return bundle.localization - .get_formatted_line( - request, loc::LineId::PingResponse, - {cpp_info, uptime, std::to_string(used_memory)}) - .value(); + return command::Response( + bundle.localization + .get_formatted_line( + request, loc::LineId::PingResponse, + {cpp_info, uptime, std::to_string(used_memory)}) + .value()); } }; } -- cgit v1.2.3