qTbot
0.2.123.6f57966
qTbot is base back end library for your c++ Qt projects.
Toggle main menu visibility
telegramargs.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 "
telegramargs.h
"
9
namespace
qTbot
{
10
11
TelegramArgs::TelegramArgs
(
const
QVariant &
id
,
12
const
QString &
text
,
13
unsigned
long
long
replyToMessageId
,
14
const
QString &
parseMode
,
15
bool
disableWebPagePreview
,
16
const
QString &
callBackQueryId
,
const
std::function<
void
(
int
)> &
msgIdCB
,
17
iRequest::RequestPriority
priority)
18
{
19
20
this->
chatId
= id;
21
this->text =
text
;
22
this->callBackQueryId =
callBackQueryId
;
23
this->disableWebPagePreview =
disableWebPagePreview
;
24
this->replyToMessageId =
replyToMessageId
;
25
this->parseMode =
parseMode
;
26
this->
msgIdCB
=
msgIdCB
;
27
this->
requestPriority
= priority;
28
}
29
30
QMap<QString, QVariant>
TelegramArgs::toMap
(
bool
textAsCaption)
const
{
31
QMap<QString, QVariant> args {{
"chat_id"
,
chatId
}};
32
33
if
(
text
.size()) {
34
if
(textAsCaption) {
35
args[
"caption"
] =
text
;
36
37
}
else
{
38
args[
"text"
] =
text
;
39
}
40
}
41
42
if
(
replyToMessageId
) {
43
args[
"reply_to_message_id"
] =
replyToMessageId
;
44
}
45
46
if
(
parseMode
.size()) {
47
args[
"parse_mode"
] =
parseMode
;
48
}
49
50
if
(
disableWebPagePreview
) {
51
args[
"disable_web_page_preview"
] =
disableWebPagePreview
;
52
}
53
54
if
(
callBackQueryId
.size()) {
55
args[
"callback_query_id"
] =
callBackQueryId
;
56
}
57
58
return
args;
59
}
60
61
}
qTbot::iRequest::RequestPriority
RequestPriority
The RequestPriority enum This is the list of request execution priorities on the client side.
Definition
irequest.h:61
qTbot
Definition
telegramdeletemessage.cpp:8
qTbot::TelegramArgs::callBackQueryId
QString callBackQueryId
Callback query ID. Default: "".
Definition
telegramargs.h:59
qTbot::TelegramArgs::disableWebPagePreview
bool disableWebPagePreview
Disable web page preview when sending links. Default: false.
Definition
telegramargs.h:77
qTbot::TelegramArgs::toMap
QMap< QString, QVariant > toMap(bool textAsCaption=false) const
toMap This method converts all arguments to a map.
Definition
telegramargs.cpp:30
qTbot::TelegramArgs::requestPriority
iRequest::RequestPriority requestPriority
requestPriority This is the priority of the request.
Definition
telegramargs.h:94
qTbot::TelegramArgs::TelegramArgs
TelegramArgs(const QVariant &id, const QString &text="", unsigned long long replyToMessageId=0, const QString &parseMode="html", bool disableWebPagePreview=false, const QString &callBackQueryId="", const std::function< void(int msgId)> &msgIdCB={}, iRequest::RequestPriority priority=iRequest::RequestPriority::NormalPriority)
TelegramArgs main constructor of the message arguments.
Definition
telegramargs.cpp:11
qTbot::TelegramArgs::parseMode
QString parseMode
Parse mode of the message. Default: "html".
Definition
telegramargs.h:71
qTbot::TelegramArgs::replyToMessageId
unsigned long long replyToMessageId
ID of the message to which a reply will be given. Default: 0.
Definition
telegramargs.h:65
qTbot::TelegramArgs::msgIdCB
std::function< void(int msgId)> msgIdCB
msgIdCB This is the message id callback function. It will be invoked when the request finishes succes...
Definition
telegramargs.h:89
qTbot::TelegramArgs::chatId
QVariant chatId
Chat ID where the message will be sent. Default: {}.
Definition
telegramargs.h:53
qTbot::TelegramArgs::text
QString text
Text of the message. Default: "".
Definition
telegramargs.h:47
telegramargs.h
src
qTbot
src
public
qTbot
telegramargs.cpp
Generated by
1.18.0