#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(ctx); } void MBFT::ModuleAPI::v1_respond(const std::string& text) { if (ctx == nullptr) { return; } std::shared_ptr new_message = std::make_shared(); MBFT::OutboundMessage& m = *new_message; m.target_chat_id = ctx->chat->id; m.text = text; connector.send(new_message); }