From 9d81978d4c875899d1493b7047895db8c7528292 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Thu, 9 May 2024 01:40:52 +0500 Subject: feat: show c++ and compiler versions in !ping command --- src/modules/ping.hpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/modules') diff --git a/src/modules/ping.hpp b/src/modules/ping.hpp index b6409ca..836917d 100644 --- a/src/modules/ping.hpp +++ b/src/modules/ping.hpp @@ -32,9 +32,26 @@ namespace bot { int used_memory = usage.ru_maxrss / 1024; + std::string cpp_info; + +#ifdef __cplusplus + cpp_info.append("C++" + std::to_string(__cplusplus).substr(2, 2)); +#endif + +#ifdef __VERSION__ + cpp_info.append(" (gcc " + + bot::utils::string::split_text(__VERSION__, ' ')[0] + + ")"); +#endif + + if (!cpp_info.empty()) { + cpp_info.append(" ยท "); + } + return bundle.localization - .get_formatted_line(request, loc::LineId::PingResponse, - {uptime, std::to_string(used_memory)}) + .get_formatted_line( + request, loc::LineId::PingResponse, + {cpp_info, uptime, std::to_string(used_memory)}) .value(); } }; -- cgit v1.2.3