forked from moritzsternemann/QtTelegramBot
Initial commit
This commit is contained in:
commit
3663fd38ce
41 files changed
+2095
No files matched your search
@@ -0,0 +1,27 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include "qttelegrambot.h"
|
||||
|
||||
#define TOKEN "YOUR BOT TOKEN"
|
||||
|
||||
Telegram::Bot *bot;
|
||||
|
||||
void newMessage(Telegram::Message message)
|
||||
{
|
||||
qDebug() << "new message:" << message;
|
||||
|
||||
if (bot && message.type == Telegram::Message::TextType) {
|
||||
bot->sendMessage(message.from.id, message.string);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
bot = new Telegram::Bot(TOKEN, false, 500, 4);
|
||||
QObject::connect(bot, &Telegram::Bot::message, &newMessage);
|
||||
qDebug() << "Started Telegram Bot";
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
Reference in new issue
Block a user