From d33b1ff7e4e07bcab906a5c2b11af895cf51c382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Fri, 21 Oct 2016 12:59:16 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/libs@130 a8b55f48-bf90-11e4-a774-851b48703e85 --- telegram_test/execbot.cpp | 10 +++++----- telegram_test/main.cpp | 13 ++++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) 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");