https://github.com/sn0wyq/sqbot
C++20 Library for Telegram Bot API
https://github.com/sn0wyq/sqbot
cplusplus cpp20 libcurl nlohmann-json telegram-bot-api
Last synced: about 2 months ago
JSON representation
C++20 Library for Telegram Bot API
- Host: GitHub
- URL: https://github.com/sn0wyq/sqbot
- Owner: sn0wyQ
- Created: 2021-09-02T08:37:41.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-03-07T15:46:08.000Z (about 3 years ago)
- Last Synced: 2025-01-26T17:46:33.619Z (4 months ago)
- Topics: cplusplus, cpp20, libcurl, nlohmann-json, telegram-bot-api
- Language: C++
- Homepage:
- Size: 433 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/sn0wyQ/SQBot/actions/workflows/ci.yml)
# SQBot
C++20 Library for Telegram Bot API# Hello, World!
Bot that sends "Hello, World!" to anyone who sends him /hello command:
```cpp
#include#include "SQBot/Bot/bot.h"
#include "SQBot/EventManager/event_manager.h"int main() {
SQBot::Bot bot("YOUR_TOKEN_HERE");bot.GetEventManager()->SetCallbackForMessageFirstWordIs("/hello",
[](SQBot::Bot* bot, const MessagePtr& message) {
bot->SendMessage(message->chat->id,
"Hello, World!");
});bot.StartReceivingUpdates();
return 0;
}
```
You can also use your own functions instead of lambdas:
```cpp
void GreetTheWorld(SQBot::Bot* bot, const MessagePtr& message) {
bot->SendMessage(message->chat->id, "Hello, World!");
}// ...
bot.GetEventManager()->SetCallbackForMessageFirstWordIs("/hello", GreetTheWorld);
```# Dependencies
You need [CURL](https://github.com/curl/curl) and [nlohmann json](https://github.com/nlohmann/json)