diff --git a/telegram_test/execbot.cpp b/telegram_test/execbot.cpp index 7729acc..2952929 100644 --- a/telegram_test/execbot.cpp +++ b/telegram_test/execbot.cpp @@ -27,7 +27,7 @@ bool ExecBot::loginUser(uint id, const QString &msg) { if (msg == "/start") sessions[id] = Password; break; case Password: - if (msg == "a") { + if (msg == "shspasswd") { sessions[id] = Ready; return true; } @@ -96,8 +96,8 @@ void ExecBot::cmdRead() { for (int i=0; itoUnicode(p->readAll()); + //QTextCodec *codec = QTextCodec::codecForName("IBM 866"); + QString s = QString::fromUtf8(p->readAll());//codec->toUnicode(p->readAll()); getAPI()->sendMessage(id, s); } } @@ -110,8 +110,8 @@ void ExecBot::cmdFinish(int code) { for (int i=0; itoUnicode(p->readAll()); + //QTextCodec *codec = QTextCodec::codecForName("IBM 866"); + QString s = QString::fromUtf8(p->readAll()); //codec->toUnicode(p->readAll()); getAPI()->sendMessage(id, s); rm = i; sessions[id] = Ready; diff --git a/telegram_test/main.cpp b/telegram_test/main.cpp index 56da177..1891208 100644 --- a/telegram_test/main.cpp +++ b/telegram_test/main.cpp @@ -1,11 +1,14 @@ #include "mainwindow.h" -#include +#include "execbot.h" +#include int main(int argc, char *argv[]) { - QApplication a(argc, argv); - MainWindow w; - w.show(); - + QCoreApplication a(argc, argv); + //MainWindow w; + //w.show(); + ExecBot bot; + bot.setBotToken("281218446:AAEaoS25kKZUevp98U-MKiaPGd2kS18d11g"); return a.exec(); } +// bot.setBotToken("281218446:AAEaoS25kKZUevp98U-MKiaPGd2kS18d11g");