Open asprs opened 1 year ago
Guys, I'm stuck. I don't receive any message. Why? Please help.
namespace broker { class telegram_bot { public: TgBot::Bot bot;
telegram_bot() : bot(config::telegram_bot.token) { bot.getEvents().onAnyMessage(std::bind(&telegram_bot::on_start, this, std::placeholders::_1)); new std::thread(&telegram_bot::work, this); } void work() { try { TgBot::TgLongPoll longPoll(bot); while (true) { LOG_INFO << "[telegram_bot] " << " Long pool started"; longPoll.start(); } LOG_INFO << "[telegram_bot] " << " Exit"; } catch (const std::exception &e) { LOG_ERROR << "[telegram_bot] " << " error: " << e.what(); } } void on_start(const TgBot::Message::Ptr message) { cout << "work" << endl; } };
}
going deeper into investigation I've created simple bot form main example and found that
TgBot::Bot bot(,,,); bot.getApi().deleteWebhook();
just hangs w/o any exception or return
Guys, I'm stuck. I don't receive any message. Why? Please help.
include
include <tgbot/tgbot.h>
include "config.h"
include "logger.h"
namespace broker { class telegram_bot { public: TgBot::Bot bot;
}