C++ library for Telegram bot API
C++ library for Telegram bot API.
Documentation is located here.
Simple echo bot which sends everything it receives:
#include
#include
#include
int main() {
TgBot::Bot bot("PLACE YOUR TOKEN HERE");
bot.getEvents().onCommand("start", [&bot](std::shared_ptr message) {
bot.getApi().sendMessage(message->chat->id, "Hi!");
});
bot.getEvents().onAnyMessage([&bot](std::shared_ptr message) {
const auto text = message->text.value_or("");
std::cout chat->id, "Your message is: " + text);
});
try {
std::cout username.value_or("") =22.1.8"Development checks are exposed through the Makefile:
make format
make lint
make testAlternatively, via Docker:
make docker-testNo open issues yet, or sync has not completed.