mirror of
https://github.com/QuasarApp/qTbot.git
synced 2025-04-27 14:24:33 +00:00
This commit is contained in:
parent
c8e88681a4
commit
536d483df2
@ -70,6 +70,41 @@ bool ITelegramBot::sendMessage(const QVariant &chatId, const QString &text) {
|
||||
return sendSpecificMessage(TelegramArgs{chatId, text});
|
||||
}
|
||||
|
||||
bool ITelegramBot::sendLocationRequest(const QVariant &chatId, const QString &text, const QString &buttonText,
|
||||
bool onetimeKeyboard) {
|
||||
|
||||
auto replyMarkup = QSharedPointer<QJsonObject>::create();
|
||||
QJsonArray keyboard;
|
||||
QJsonObject contactButton;
|
||||
contactButton["text"] = buttonText;
|
||||
contactButton["request_location"] = true;
|
||||
QJsonArray row;
|
||||
row.append(contactButton);
|
||||
keyboard.append(row);
|
||||
replyMarkup->insert("keyboard", keyboard);
|
||||
replyMarkup->insert("resize_keyboard", true);
|
||||
replyMarkup->insert("one_time_keyboard", onetimeKeyboard);
|
||||
|
||||
return sendSpecificMessage(TelegramArgs{chatId, text}, {{"reply_markup", replyMarkup}});
|
||||
}
|
||||
|
||||
bool ITelegramBot::sendSelfContactRequest(const QVariant &chatId, const QString &text, const QString &buttonText,
|
||||
bool onetimeKeyboard) {
|
||||
auto replyMarkup = QSharedPointer<QJsonObject>::create();
|
||||
QJsonArray keyboard;
|
||||
QJsonObject contactButton;
|
||||
contactButton["text"] = buttonText;
|
||||
contactButton["request_contact"] = true;
|
||||
QJsonArray row;
|
||||
row.append(contactButton);
|
||||
keyboard.append(row);
|
||||
replyMarkup->insert("keyboard", keyboard);
|
||||
replyMarkup->insert("resize_keyboard", true);
|
||||
replyMarkup->insert("one_time_keyboard", onetimeKeyboard);
|
||||
|
||||
return sendSpecificMessage(TelegramArgs{chatId, text}, {{"reply_markup", replyMarkup}});
|
||||
}
|
||||
|
||||
bool ITelegramBot::sendSpecificMessage(const TelegramArgs& args,
|
||||
const ExtraJsonObjects &extraObjects) {
|
||||
|
||||
|
@ -42,6 +42,24 @@ public:
|
||||
|
||||
bool sendMessage(const QVariant &chatId, const QString& text) override;
|
||||
|
||||
/**
|
||||
* @brief sendLocationRequest This method setn into chat button that will automaticaly sent geo location to bot.
|
||||
* @param chatId
|
||||
* @param text message text
|
||||
* @param buttonText Text on the button
|
||||
* @return true if request sents successfull else false.
|
||||
*/
|
||||
bool sendLocationRequest(const QVariant &chatId, const QString& text, const QString &buttonText, bool onetimeKeyboard);
|
||||
|
||||
/**
|
||||
* @brief sendSelfContactRequest This method sent into chat button that will automaticaly sent self contact information to bot.
|
||||
* @param chatId
|
||||
* @param text message text
|
||||
* @param buttonText Text on the button
|
||||
* @return true if request sents successfull else false.
|
||||
*/
|
||||
bool sendSelfContactRequest(const QVariant &chatId, const QString& text, const QString &buttonText, bool onetimeKeyboard);
|
||||
|
||||
/**
|
||||
* @brief Sends a specific message to a chat.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user