From d1793df1eda463b10107d41785ad1d7f055ed476 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 18 May 2024 14:48:12 +0500 Subject: upd: moved the bot part to a relative subfolder --- bot/src/modules/help.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 bot/src/modules/help.hpp (limited to 'bot/src/modules/help.hpp') diff --git a/bot/src/modules/help.hpp b/bot/src/modules/help.hpp new file mode 100644 index 0000000..13af228 --- /dev/null +++ b/bot/src/modules/help.hpp @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include + +#include "../bundle.hpp" +#include "../commands/command.hpp" +#include "../commands/response_error.hpp" + +namespace bot { + namespace mod { + 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 { + 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(); + } + }; + } +} -- cgit v1.2.3