qTbot 0.89.ee6949a
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-2024 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
22 for (auto it = extraObjects.begin(); it != extraObjects.end(); it = std::next(it)) {
23 args[it.key()] = QJsonDocument(*it.value()).toJson(QJsonDocument::Compact);
24 }
25
27}
28}
TelegramSendMsg(const TelegramArgs &args, const ExtraJsonObjects &extraObjects={})
TelegramSendMsg This object sents msg to telegram server.
The TelegramSingleRquest class Is base class for all single requests commands with arguments.
const QMap< QString, QVariant > & args() const
args This method returns a current list of arguments
Definition irequest.cpp:30
void setArgs(const QMap< QString, QVariant > &newArgs)
setArgs For the some requests list of arguments posible to build only after constructor.
Definition irequest.cpp:38
The TelegramArgs class is base structure for the all tellegram message arguments.
QMap< QString, QVariant > toMap(bool textAsCaption=false) const
toMap convert all arguments to the map.