xbot/bot.hpp

33 lines
737 B
C++
Raw Normal View History

2025-01-25 21:24:33 -08:00
#pragma once
#include "self_thread.hpp"
#include <boost/signals2.hpp>
#include <memory>
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;
};
struct Bot : std::enable_shared_from_this<Bot>
{
std::shared_ptr<SelfThread> self_;
char command_prefix_;
Bot(std::shared_ptr<SelfThread> self)
: self_{std::move(self)}
, command_prefix_{'!'}
{}
auto on_ircmsg(IrcCommand, const IrcMsg &) -> void;
auto process_command(std::string_view message, const IrcMsg &msg) -> void;
static auto start(std::shared_ptr<SelfThread>) -> std::shared_ptr<Bot>;
};