LibTgBotPP
 All Classes Namespaces Files Functions Variables Typedefs Macros
example02.cc File Reference
#include <Telegram/TelegramBot.h>
#include <sstream>
#include <string>
#include <termios.h>
#include <unistd.h>

Go to the source code of this file.

Macros

#define WEBHOOK_URL   "https://your-domain/cgi-bin/bot.cgi"
 
#define BOT_TOKEN   "your secret token"
 

Functions

int main (int argc, char **argv)
 

Macro Definition Documentation

#define BOT_TOKEN   "your secret token"

Definition at line 35 of file example02.cc.

#define WEBHOOK_URL   "https://your-domain/cgi-bin/bot.cgi"

This is a simple Telegram client that can echo a message, piped to its binary and to set your web hook.

If you want to use this example to send your web hook to Telegram's API, change BOT_TOKEN according to your needs and your web server!

Example: BOT_TOKEN: Your token given by Telegram's Bot Father!

To compile do: g++ -c -o example02.o -I/usr/include/jsoncpp example02.cc g++ -o example02 example02.o -ltgbotpp

Run: echo "Your message" | ./example02 -u <your user="" id>="">

To set your web hook to Telegram's network: ./example02 -w

To send a photo to a user or group: ./example02 -p file:///path/to/pic.jpg -u <user id>="">

Definition at line 34 of file example02.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 38 of file example02.cc.