37 lines
833 B
C++
37 lines
833 B
C++
#pragma once
|
|
|
|
#include "client.hpp"
|
|
|
|
#include <boost/signals2.hpp>
|
|
|
|
#include <memory>
|
|
|
|
struct Bot : std::enable_shared_from_this<Bot>
|
|
{
|
|
struct Command
|
|
{
|
|
std::string_view source;
|
|
std::string_view target;
|
|
std::string_view oper;
|
|
std::string_view account;
|
|
std::string_view command;
|
|
std::string_view arguments;
|
|
};
|
|
|
|
std::shared_ptr<Client> self_;
|
|
char command_prefix_;
|
|
|
|
boost::signals2::signal<void(const Command &)> sig_command;
|
|
|
|
Bot(std::shared_ptr<Client> self)
|
|
: self_{std::move(self)}
|
|
, command_prefix_{'!'}
|
|
{}
|
|
|
|
auto on_chat(const Chat &) -> void;
|
|
auto process_command(std::string_view message, const Chat &msg) -> void;
|
|
static auto start(std::shared_ptr<Client>) -> std::shared_ptr<Bot>;
|
|
|
|
auto shutdown() -> void;
|
|
};
|