Introduce MBFT::Module and MBFT::ModuleAPI

This commit is contained in:
2026-07-15 17:51:48 +03:00
parent b761e71668
commit 2810efded7
4 changed files with 180 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#include "modules/ModuleAPI.h"
MBFT::ModuleAPI::ModuleAPI(MBFT::IConnector& c)
: connector(c)
{
}
void MBFT::ModuleAPI::set_context(const MBFT::InboundMessage * const ctx)
{
this->ctx = const_cast<MBFT::InboundMessage *>(ctx);
}
void MBFT::ModuleAPI::v1_respond(const std::string& text)
{
if (ctx == nullptr)
{
return;
}
std::shared_ptr<MBFT::OutboundMessage> new_message = std::make_shared<MBFT::OutboundMessage>();
MBFT::OutboundMessage& m = *new_message;
m.target_chat_id = ctx->chat->id;
m.text = text;
connector.send(new_message);
}