47 lines
1.1 KiB
C++
47 lines
1.1 KiB
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 <string_view>
|
|
|
|
#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);
|
|
static std::string_view pop(std::string_view& input, char delimiter = ' ');
|
|
|
|
virtual Shared::Result message(const std::shared_ptr<::Actor>& actor, std::string_view view) = 0;
|
|
|
|
public:
|
|
const std::string name;
|
|
const std::string alias;
|
|
|
|
protected:
|
|
std::shared_ptr<Core> core;
|
|
Shared::Permissions permissions;
|
|
|
|
};
|
|
|
|
}
|