From 32506ce7fcc9990961779b1b00a32a31fa985b45 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Fri, 11 Apr 2025 01:16:09 +0500 Subject: feat: !spam in lua --- bot/src/commands/command.cpp | 2 -- bot/src/modules/spam.hpp | 54 -------------------------------------------- 2 files changed, 56 deletions(-) delete mode 100644 bot/src/modules/spam.hpp (limited to 'bot/src') diff --git a/bot/src/commands/command.cpp b/bot/src/commands/command.cpp index 73ea90d..4ec8e59 100644 --- a/bot/src/commands/command.cpp +++ b/bot/src/commands/command.cpp @@ -20,7 +20,6 @@ #include "../modules/mcsrv.hpp" #include "../modules/notify.hpp" #include "../modules/settings.hpp" -#include "../modules/spam.hpp" #include "../modules/timer.hpp" #include "../modules/user.hpp" #include "../utils/chrono.hpp" @@ -38,7 +37,6 @@ namespace bot { this->add_command(std::make_unique()); this->add_command(std::make_unique()); this->add_command(std::make_unique()); - this->add_command(std::make_unique()); this->add_command(std::make_unique()); this->add_command(std::make_unique()); this->add_command(std::make_unique()); diff --git a/bot/src/modules/spam.hpp b/bot/src/modules/spam.hpp deleted file mode 100644 index bc2c7f3..0000000 --- a/bot/src/modules/spam.hpp +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "../bundle.hpp" -#include "../commands/command.hpp" -#include "../commands/response_error.hpp" - -namespace bot { - namespace mod { - class Spam : public command::Command { - std::string get_name() const override { return "spam"; } - - schemas::PermissionLevel get_permission_level() const override { - return schemas::PermissionLevel::MODERATOR; - } - - int get_delay_seconds() const override { return 10; } - - command::Response run(const InstanceBundle &bundle, - const command::Request &request) const override { - if (!request.message.has_value()) { - throw ResponseException( - request, bundle.localization, command::MESSAGE); - } - - std::vector parts = - utils::string::split_text(request.message.value(), ' '); - - int count = SPAM_DEFAULT_COUNT; - std::string message = request.message.value(); - - try { - count = std::stoi(parts[0]); - - if (count > SPAM_MAX_COUNT) count = SPAM_MAX_COUNT; - message = utils::string::join_vector( - {parts.begin() + 1, parts.end()}, ' '); - } catch (std::exception &e) { - } - - std::vector output; - - for (int i = 0; i < count; i++) { - output.push_back(message); - } - - return command::Response(output); - } - }; - } -} -- cgit v1.2.3