summaryrefslogtreecommitdiff
path: root/src/modules/massping.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/massping.hpp
parentd7a2de17e9b7931f68b5b4079b1c36866a19d343 (diff)
upd: moved the bot part to a relative subfolder
Diffstat (limited to 'src/modules/massping.hpp')
-rw-r--r--src/modules/massping.hpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/modules/massping.hpp b/src/modules/massping.hpp
deleted file mode 100644
index 2957e34..0000000
--- a/src/modules/massping.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#pragma once
-
-#include <string>
-#include <variant>
-#include <vector>
-
-#include "../bundle.hpp"
-#include "../commands/command.hpp"
-
-namespace bot {
- namespace mod {
- class Massping : public command::Command {
- std::string get_name() const override { return "massping"; }
-
- schemas::PermissionLevel get_permission_level() const override {
- return schemas::PermissionLevel::MODERATOR;
- }
-
- int get_delay_seconds() const override { return 1; }
-
- std::variant<std::vector<std::string>, std::string> run(
- const InstanceBundle &bundle,
- const command::Request &request) const override {
- auto chatters = bundle.helix_client.get_chatters(
- request.channel.get_alias_id(), bundle.irc_client.get_bot_id());
-
- std::string m;
-
- if (request.message.has_value()) {
- m = request.message.value() + " ·";
- }
-
- std::string base = "📣 " + m + " ";
- std::vector<std::string> msgs = {""};
- int index = 0;
-
- for (const auto &chatter : chatters) {
- const std::string &current_msg = msgs.at(index);
- std::string x = "@" + chatter.login;
-
- if (base.length() + current_msg.length() + 1 + x.length() >= 500) {
- index += 1;
- }
-
- if (index > msgs.size() - 1) {
- msgs.push_back(x);
- } else {
- msgs[index] = current_msg + " " + x;
- }
- }
-
- std::vector<std::string> msgs2;
-
- for (const auto &m : msgs) {
- msgs2.push_back(base + m);
- }
-
- return msgs2;
- }
- };
- }
-}