summaryrefslogtreecommitdiff
path: root/src/modules/ping.hpp
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-05-18 14:48:12 +0500
committerilotterytea <iltsu@alright.party>2024-05-18 14:48:12 +0500
commitd1793df1eda463b10107d41785ad1d7f055ed476 (patch)
treefd3e41c3b4a05924748ae4b762e1ae55a0bc815c /src/modules/ping.hpp
parentd7a2de17e9b7931f68b5b4079b1c36866a19d343 (diff)
upd: moved the bot part to a relative subfolder
Diffstat (limited to 'src/modules/ping.hpp')
-rw-r--r--src/modules/ping.hpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/modules/ping.hpp b/src/modules/ping.hpp
deleted file mode 100644
index 836917d..0000000
--- a/src/modules/ping.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#pragma once
-
-#include <sys/resource.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <chrono>
-#include <string>
-#include <variant>
-#include <vector>
-
-#include "../bundle.hpp"
-#include "../commands/command.hpp"
-#include "../utils/chrono.hpp"
-
-namespace bot {
- namespace mod {
- class Ping : public command::Command {
- std::string get_name() const override { return "ping"; }
-
- std::variant<std::vector<std::string>, std::string> run(
- const InstanceBundle &bundle,
- const command::Request &request) const override {
- auto now = std::chrono::steady_clock::now();
- auto duration = now - START_TIME;
- auto seconds =
- std::chrono::duration_cast<std::chrono::seconds>(duration);
- std::string uptime = utils::chrono::format_timestamp(seconds.count());
-
- struct rusage usage;
- getrusage(RUSAGE_SELF, &usage);
-
- 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,
- {cpp_info, uptime, std::to_string(used_memory)})
- .value();
- }
- };
- }
-}