jay/module/module.h
2025-03-31 13:02:45 +03:00

45 lines
1023 B
C++

// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <string>
#include <memory>
#include <vector>
#include <ranges>
#include <cctype>
#include "shared/definitions.h"
#include "shared/result.h"
#include "shared/loggable.h"
#include "component/core.h"
#include "component/actor.h"
#include "component/config.h"
namespace Module {
class Module : protected Shared::Loggable {
protected:
Module(const std::shared_ptr<Core>& core, const Config::Module& conf, const std::string& name);
bool hasPermission(const std::string& permission, const std::shared_ptr<::Actor>& actor) const;
public:
virtual ~Module() noexcept;
static std::string lower(const std::string& text);
virtual Shared::Result message(const std::shared_ptr<::Actor>& actor, const Shared::Strings& args) = 0;
public:
const std::string name;
const std::string alias;
protected:
std::shared_ptr<Core> core;
Shared::Permissions permissions;
};
}