40 lines
939 B
C++
40 lines
939 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"
|
|
|
|
namespace Module {
|
|
|
|
class Module : protected Shared::Loggable {
|
|
protected:
|
|
Module(const std::shared_ptr<Core>& core, const Shared::Permissions& permissions, 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;
|
|
|
|
protected:
|
|
std::shared_ptr<Core> core;
|
|
Shared::Permissions permissions;
|
|
|
|
};
|
|
|
|
}
|