41 bool login(
const QByteArray &token)
override;
43 bool sendMessage(
const QVariant &chatId,
const QString& text)
override;
52 bool sendLocationRequest(
const QVariant &chatId,
const QString& text,
const QString &buttonText,
bool onetimeKeyboard);
61 bool sendSelfContactRequest(
const QVariant &chatId,
const QString& text,
const QString &buttonText,
bool onetimeKeyboard);
89 bool sendSpecificMessageWithKeyboard(
const TelegramArgs& args,
107 bool sendSpecificMessageWithKeyboard(
const TelegramArgs& args,
108 const QList<QList<QString> > &keyboard,
109 bool onTimeKeyboard =
false,
110 bool autoResizeKeyboard =
true);
112 bool deleteMessage(
const QVariant& chatId,
const QVariant& messageId)
override;
129 bool editSpecificMessageWithKeyboard(
const QVariant &messageId,
131 const QList<QList<QString> > &keyboard = {},
132 bool onTimeKeyboard =
false,
133 bool autoResizeKeyboard =
false);
150 bool editSpecificMessageWithKeyboard(
const QVariant& messageId,
170 bool editMessageKeyboard(
const QVariant& messageId,
171 const QVariant &chatId,
173 const QString &callBackQueryId =
"");
187 bool editSpecificMessage(
const QVariant &messageId,
190 [[nodiscard(
"do not forget to save shared pointer of file handler, because it's will not save inner bot object.")]]
191 QSharedPointer<iFile> getFile(
const QString& fileId,
iFile::Type fileType = iFile::Type::Ram)
override;
199 QSharedPointer<QNetworkReply> getFileMeta(
const QString& fileId,
200 const QWeakPointer<iFile> &receiver = {
nullptr});
202 bool sendFile(
const QFileInfo& file,
const QVariant& chatId)
override;
204 bool sendFile(
const QByteArray& file,
const QString& fileName,
const QVariant& chatId)
override;
212 bool sendFileMessage(
const TelegramArgs& args,
const QFileInfo& file);
221 bool sendFileMessage(
const TelegramArgs& args,
const QByteArray& file,
const QString& fileName);
232 const QFileInfo& photo,
245 const QByteArray& photo,
246 const QString& fileName,
255 bool sendFileById(
const QString& fileID,
const QVariant& chatId);
280 const QString& phone,
281 const QString& firstName,
282 const QString& secondName =
"");
329 unsigned long long id()
const;
335 const QString& username()
const;
342 int gelLastMessageId(
unsigned long long &chatId)
const;
350 void setId(
unsigned long long newId);
356 void setUsername(
const QString &newUsername);
358 QString makeUrl(
const QSharedPointer<iRequest>& request)
const override;
365 int getFileSizeByUniqueId(
const QString&
id)
const;
372 QSharedPointer<TelegramFile> getFileInfoByUniqueId(
const QString&
id)
const;
378 virtual void onRequestError(
const QSharedPointer<TelegramUpdateAnswer>& ansverWithError)
const;
380 void handleIncomeNewUpdate(
const QSharedPointer<iUpdate> &)
override;
388 virtual bool sendMessageRequest(
const QSharedPointer<iRequest> &rquest,
389 const std::function<
void(
int msgId)>& msgIdCB = {});
393 void handleLoginErr(QNetworkReply::NetworkError err);
394 void handleFileHeader(
const QWeakPointer<QNetworkReply>& sender,
395 const QWeakPointer<iFile> &receiver);
399 QString findFileInlocatStorage(
const QString& fileId)
const;
400 QHash<QString, QSharedPointer<QJsonObject> >
404 const QList<QList<QString> > &keyboard);
406 unsigned long long _id = 0;
408 QSharedPointer<QNetworkReply> _loginReplay;
409 QMap<QString, std::function<void(
const QString&,
const QVariant&)>> _handleButtons;
411 QHash<unsigned long long, int> _lastMessageId;
413 QHash<QString, QSharedPointer<TelegramFile>> _filesMetaInfo;