32 lines
709 B
C++
32 lines
709 B
C++
|
|
#include <iostream>
|
||
|
|
|
||
|
|
#include "connectors/tgbot-cpp/TgbotCppConnector.h"
|
||
|
|
#include "modules/Module.h"
|
||
|
|
|
||
|
|
int main(void)
|
||
|
|
{
|
||
|
|
std::shared_ptr<MBFT::TgbotCppConnector> c = std::make_shared<MBFT::TgbotCppConnector>();
|
||
|
|
MBFT::ModuleAPI api(*c);
|
||
|
|
|
||
|
|
MBFT::Module m("modules/echo/main.so");
|
||
|
|
|
||
|
|
for ( ; ; )
|
||
|
|
{
|
||
|
|
std::shared_ptr<MBFT::InboundMessage> msg = c->receive();
|
||
|
|
api.set_context(msg.get());
|
||
|
|
|
||
|
|
std::cout << "New message: " << msg.get()->text << "\n";
|
||
|
|
|
||
|
|
m.process(api, *msg);
|
||
|
|
|
||
|
|
/*
|
||
|
|
std::shared_ptr<MBFT::OutboundMessage> reply = std::make_shared<MBFT::OutboundMessage>();
|
||
|
|
|
||
|
|
reply->target_chat_id = msg->chat->id;
|
||
|
|
reply->text = std::string("Hello! The message was:\n") + msg->text;
|
||
|
|
|
||
|
|
c->send(reply);
|
||
|
|
*/
|
||
|
|
}
|
||
|
|
}
|