qTbot 0.2.123.6f57966
qTbot is base back end library for your c++ Qt projects.
telegramsendmsg.cpp
Go to the documentation of this file.
1//#
2//# Copyright (C) 2023-2026 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7
8#include "telegramsendmsg.h"
9
10#include <QJsonDocument>
11#include <QJsonObject>
12namespace qTbot {
13
15 const QHash<QString, QSharedPointer<QJsonObject> > &extraObjects)
16 :
17 TelegramSingleRquest("sendMessage")
18{
19
20 QMap<QString, QVariant>&& args = generalArgs.toMap();
21 setPriority(generalArgs.requestPriority);
22
23 for (auto it = extraObjects.begin(); it != extraObjects.end(); it = std::next(it)) {
24 args[it.key()] = QJsonDocument(*it.value()).toJson(QJsonDocument::Compact);
25 }
26
28}
29}
TelegramSendMsg(const TelegramArgs &args, const ExtraJsonObjects &extraObjects={})
TelegramSendMsg This object sends a message to the telegram server.
TelegramSingleRquest(const QString &request, const QMap< QString, QVariant > &args)
TelegramSingleRquest This is the main constructor of the single requests.
const QMap< QString, QVariant > & args() const
args This method returns the the current list of arguments
Definition irequest.cpp:30
void setArgs(const QMap< QString, QVariant > &newArgs)
setArgs For some requests the list of arguments is possible to build only after the constructor.
Definition irequest.cpp:38
void setPriority(RequestPriority newPriority)
setPriority This method sets a new priority for the request.
Definition irequest.cpp:98
The TelegramArgs class is the base structure for all telegram message arguments.
QMap< QString, QVariant > toMap(bool textAsCaption=false) const
toMap This method converts all arguments to a map.
iRequest::RequestPriority requestPriority
requestPriority This is the priority of the request.