Add td_api::editBusinessMessageLiveLocation.
This commit is contained in:
parent
c1c9f40a20
commit
96c1b0081f
@ -8448,6 +8448,18 @@ sendBusinessMessageAlbum business_connection_id:string chat_id:int53 reply_to:In
|
|||||||
//@input_message_content New text content of the message. Must be of type inputMessageText
|
//@input_message_content New text content of the message. Must be of type inputMessageText
|
||||||
editBusinessMessageText business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage;
|
editBusinessMessageText business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = BusinessMessage;
|
||||||
|
|
||||||
|
//@description Edits the content of a live location in a message message sent on behalf of a business account; for bots only
|
||||||
|
//@business_connection_id Unique identifier of business connection on behalf of which the message was sent
|
||||||
|
//@chat_id The chat the message belongs to
|
||||||
|
//@message_id Identifier of the message
|
||||||
|
//@reply_markup The new message reply markup; pass null if none
|
||||||
|
//@location New location content of the message; pass null to stop sharing the live location
|
||||||
|
//@live_period New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever.
|
||||||
|
//-Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period
|
||||||
|
//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown
|
||||||
|
//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled
|
||||||
|
editBusinessMessageLiveLocation business_connection_id:string chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = BusinessMessage;
|
||||||
|
|
||||||
|
|
||||||
//@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters
|
//@description Checks validness of a name for a quick reply shortcut. Can be called synchronously @name The name of the shortcut; 1-32 characters
|
||||||
checkQuickReplyShortcutName name:string = Ok;
|
checkQuickReplyShortcutName name:string = Ok;
|
||||||
|
@ -1185,6 +1185,42 @@ void BusinessConnectionManager::edit_business_message_text(
|
|||||||
std::move(input_reply_markup));
|
std::move(input_reply_markup));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BusinessConnectionManager::edit_business_message_live_location(
|
||||||
|
BusinessConnectionId business_connection_id, DialogId dialog_id, MessageId message_id,
|
||||||
|
td_api::object_ptr<td_api::ReplyMarkup> &&reply_markup, td_api::object_ptr<td_api::location> &&input_location,
|
||||||
|
int32 live_period, int32 heading, int32 proximity_alert_radius,
|
||||||
|
Promise<td_api::object_ptr<td_api::businessMessage>> &&promise) {
|
||||||
|
TRY_STATUS_PROMISE(promise, check_business_connection(business_connection_id, dialog_id));
|
||||||
|
TRY_STATUS_PROMISE(promise, check_business_message_id(message_id));
|
||||||
|
|
||||||
|
Location location(input_location);
|
||||||
|
if (location.empty() && input_location != nullptr) {
|
||||||
|
return promise.set_error(Status::Error(400, "Invalid location specified"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TRY_RESULT_PROMISE(promise, new_reply_markup,
|
||||||
|
get_reply_markup(std::move(reply_markup), td_->auth_manager_->is_bot(), true, false, true));
|
||||||
|
auto input_reply_markup = get_input_reply_markup(td_->user_manager_.get(), new_reply_markup);
|
||||||
|
|
||||||
|
int32 flags = 0;
|
||||||
|
if (location.empty()) {
|
||||||
|
flags |= telegram_api::inputMediaGeoLive::STOPPED_MASK;
|
||||||
|
}
|
||||||
|
if (live_period != 0) {
|
||||||
|
flags |= telegram_api::inputMediaGeoLive::PERIOD_MASK;
|
||||||
|
}
|
||||||
|
if (heading != 0) {
|
||||||
|
flags |= telegram_api::inputMediaGeoLive::HEADING_MASK;
|
||||||
|
}
|
||||||
|
flags |= telegram_api::inputMediaGeoLive::PROXIMITY_NOTIFICATION_RADIUS_MASK;
|
||||||
|
auto input_media = telegram_api::make_object<telegram_api::inputMediaGeoLive>(
|
||||||
|
flags, false /*ignored*/, location.get_input_geo_point(), heading, live_period, proximity_alert_radius);
|
||||||
|
td_->create_handler<EditBusinessMessageQuery>(std::move(promise))
|
||||||
|
->send(0, business_connection_id, dialog_id, message_id, string(),
|
||||||
|
vector<telegram_api::object_ptr<telegram_api::MessageEntity>>(), std::move(input_media), false /*ignored*/,
|
||||||
|
std::move(input_reply_markup));
|
||||||
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::updateBusinessConnection> BusinessConnectionManager::get_update_business_connection(
|
td_api::object_ptr<td_api::updateBusinessConnection> BusinessConnectionManager::get_update_business_connection(
|
||||||
const BusinessConnection *connection) const {
|
const BusinessConnection *connection) const {
|
||||||
return td_api::make_object<td_api::updateBusinessConnection>(connection->get_business_connection_object(td_));
|
return td_api::make_object<td_api::updateBusinessConnection>(connection->get_business_connection_object(td_));
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "td/telegram/DialogId.h"
|
#include "td/telegram/DialogId.h"
|
||||||
#include "td/telegram/files/FileId.h"
|
#include "td/telegram/files/FileId.h"
|
||||||
#include "td/telegram/MessageEffectId.h"
|
#include "td/telegram/MessageEffectId.h"
|
||||||
|
#include "td/telegram/MessageId.h"
|
||||||
#include "td/telegram/MessageInputReplyTo.h"
|
#include "td/telegram/MessageInputReplyTo.h"
|
||||||
#include "td/telegram/net/DcId.h"
|
#include "td/telegram/net/DcId.h"
|
||||||
#include "td/telegram/td_api.h"
|
#include "td/telegram/td_api.h"
|
||||||
@ -78,6 +79,12 @@ class BusinessConnectionManager final : public Actor {
|
|||||||
td_api::object_ptr<td_api::InputMessageContent> &&input_message_content,
|
td_api::object_ptr<td_api::InputMessageContent> &&input_message_content,
|
||||||
Promise<td_api::object_ptr<td_api::businessMessage>> &&promise);
|
Promise<td_api::object_ptr<td_api::businessMessage>> &&promise);
|
||||||
|
|
||||||
|
void edit_business_message_live_location(BusinessConnectionId business_connection_id, DialogId dialog_id,
|
||||||
|
MessageId message_id, td_api::object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||||
|
td_api::object_ptr<td_api::location> &&input_location, int32 live_period,
|
||||||
|
int32 heading, int32 proximity_alert_radius,
|
||||||
|
Promise<td_api::object_ptr<td_api::businessMessage>> &&promise);
|
||||||
|
|
||||||
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -5814,6 +5814,15 @@ void Td::on_request(uint64 id, td_api::editBusinessMessageText &request) {
|
|||||||
std::move(promise));
|
std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Td::on_request(uint64 id, td_api::editBusinessMessageLiveLocation &request) {
|
||||||
|
CHECK_IS_BOT();
|
||||||
|
CREATE_REQUEST_PROMISE();
|
||||||
|
business_connection_manager_->edit_business_message_live_location(
|
||||||
|
BusinessConnectionId(std::move(request.business_connection_id_)), DialogId(request.chat_id_),
|
||||||
|
MessageId(request.message_id_), std::move(request.reply_markup_), std::move(request.location_),
|
||||||
|
request.live_period_, request.heading_, request.proximity_alert_radius_, std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::loadQuickReplyShortcuts &request) {
|
void Td::on_request(uint64 id, const td_api::loadQuickReplyShortcuts &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
@ -918,6 +918,8 @@ class Td final : public Actor {
|
|||||||
|
|
||||||
void on_request(uint64 id, td_api::editBusinessMessageText &request);
|
void on_request(uint64 id, td_api::editBusinessMessageText &request);
|
||||||
|
|
||||||
|
void on_request(uint64 id, td_api::editBusinessMessageLiveLocation &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::loadQuickReplyShortcuts &request);
|
void on_request(uint64 id, const td_api::loadQuickReplyShortcuts &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::setQuickReplyShortcutName &request);
|
void on_request(uint64 id, const td_api::setQuickReplyShortcutName &request);
|
||||||
|
Loading…
Reference in New Issue
Block a user