Add td_api::setBusinessGreetingMessageSettings.
This commit is contained in:
parent
66761d1950
commit
50ba48fbfa
|
@ -625,9 +625,9 @@ businessWorkHours time_zone_id:string work_hours:vector<businessWorkHoursInterva
|
||||||
//@description Contains information about a Telegram Business account
|
//@description Contains information about a Telegram Business account
|
||||||
//@location Location of the business; may be null if none
|
//@location Location of the business; may be null if none
|
||||||
//@work_hours Work hours of the business; may be null if none
|
//@work_hours Work hours of the business; may be null if none
|
||||||
//@away_message_settings The away message; may be null if none or the Business account is not of the current user
|
|
||||||
//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user
|
//@greeting_message_settings The greeting message; may be null if none or the Business account is not of the current user
|
||||||
businessInfo location:businessLocation work_hours:businessWorkHours away_message_settings:businessAwayMessageSettings greeting_message_settings:businessGreetingMessageSettings = BusinessInfo;
|
//@away_message_settings The away message; may be null if none or the Business account is not of the current user
|
||||||
|
businessInfo location:businessLocation work_hours:businessWorkHours greeting_message_settings:businessGreetingMessageSettings away_message_settings:businessAwayMessageSettings = BusinessInfo;
|
||||||
|
|
||||||
|
|
||||||
//@class ChatPhotoStickerType @description Describes type of a sticker, which was used to create a chat photo
|
//@class ChatPhotoStickerType @description Describes type of a sticker, which was used to create a chat photo
|
||||||
|
@ -9353,6 +9353,9 @@ setBusinessLocation location:businessLocation = Ok;
|
||||||
//@description Changes the business work hours of the current user. Requires Telegram Business subscription @work_hours The new work hours of the business; pass null to remove the work hours
|
//@description Changes the business work hours of the current user. Requires Telegram Business subscription @work_hours The new work hours of the business; pass null to remove the work hours
|
||||||
setBusinessWorkHours work_hours:businessWorkHours = Ok;
|
setBusinessWorkHours work_hours:businessWorkHours = Ok;
|
||||||
|
|
||||||
|
//@description Changes the business greeting message settings of the current user. Requires Telegram Business subscription @greeting_message_settings The new settings for the greeting message of the business; pass null to disable the greeting message
|
||||||
|
setBusinessGreetingMessageSettings greeting_message_settings:businessGreetingMessageSettings = Ok;
|
||||||
|
|
||||||
//@description Changes the business away message settings of the current user. Requires Telegram Business subscription @away_message_settings The new settings for the away message of the business; pass null to disable the away message
|
//@description Changes the business away message settings of the current user. Requires Telegram Business subscription @away_message_settings The new settings for the away message of the business; pass null to disable the away message
|
||||||
setBusinessAwayMessageSettings away_message_settings:businessAwayMessageSettings = Ok;
|
setBusinessAwayMessageSettings away_message_settings:businessAwayMessageSettings = Ok;
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ namespace td {
|
||||||
td_api::object_ptr<td_api::businessInfo> BusinessInfo::get_business_info_object(Td *td) const {
|
td_api::object_ptr<td_api::businessInfo> BusinessInfo::get_business_info_object(Td *td) const {
|
||||||
return td_api::make_object<td_api::businessInfo>(location_.get_business_location_object(),
|
return td_api::make_object<td_api::businessInfo>(location_.get_business_location_object(),
|
||||||
work_hours_.get_business_work_hours_object(),
|
work_hours_.get_business_work_hours_object(),
|
||||||
away_message_.get_business_away_message_settings_object(td),
|
greeting_message_.get_business_greeting_message_settings_object(td),
|
||||||
greeting_message_.get_business_greeting_message_settings_object(td));
|
away_message_.get_business_away_message_settings_object(td));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BusinessInfo::is_empty_location(const DialogLocation &location) {
|
bool BusinessInfo::is_empty_location(const DialogLocation &location) {
|
||||||
|
|
|
@ -1167,6 +1167,42 @@ class UpdateBusinessWorkHoursQuery final : public Td::ResultHandler {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class UpdateBusinessGreetingMessageQuery final : public Td::ResultHandler {
|
||||||
|
Promise<Unit> promise_;
|
||||||
|
BusinessGreetingMessage greeting_message_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit UpdateBusinessGreetingMessageQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void send(BusinessGreetingMessage &&greeting_message) {
|
||||||
|
greeting_message_ = std::move(greeting_message);
|
||||||
|
int32 flags = 0;
|
||||||
|
if (!greeting_message_.is_empty()) {
|
||||||
|
flags |= telegram_api::account_updateBusinessGreetingMessage::MESSAGE_MASK;
|
||||||
|
}
|
||||||
|
send_query(G()->net_query_creator().create(telegram_api::account_updateBusinessGreetingMessage(
|
||||||
|
flags, greeting_message_.get_input_business_greeting_message(td_)),
|
||||||
|
{{"me"}}));
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_result(BufferSlice packet) final {
|
||||||
|
auto result_ptr = fetch_result<telegram_api::account_updateBusinessGreetingMessage>(packet);
|
||||||
|
if (result_ptr.is_error()) {
|
||||||
|
return on_error(result_ptr.move_as_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
td_->contacts_manager_->on_update_user_greeting_message(td_->contacts_manager_->get_my_id(),
|
||||||
|
std::move(greeting_message_));
|
||||||
|
|
||||||
|
promise_.set_value(Unit());
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_error(Status status) final {
|
||||||
|
promise_.set_error(std::move(status));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class UpdateBusinessAwayMessageQuery final : public Td::ResultHandler {
|
class UpdateBusinessAwayMessageQuery final : public Td::ResultHandler {
|
||||||
Promise<Unit> promise_;
|
Promise<Unit> promise_;
|
||||||
BusinessAwayMessage away_message_;
|
BusinessAwayMessage away_message_;
|
||||||
|
@ -7064,6 +7100,11 @@ void ContactsManager::set_business_work_hours(BusinessWorkHours &&work_hours, Pr
|
||||||
td_->create_handler<UpdateBusinessWorkHoursQuery>(std::move(promise))->send(std::move(work_hours));
|
td_->create_handler<UpdateBusinessWorkHoursQuery>(std::move(promise))->send(std::move(work_hours));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContactsManager::set_business_greeting_message(BusinessGreetingMessage &&greeting_message,
|
||||||
|
Promise<Unit> &&promise) {
|
||||||
|
td_->create_handler<UpdateBusinessGreetingMessageQuery>(std::move(promise))->send(std::move(greeting_message));
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::set_business_away_message(BusinessAwayMessage &&away_message, Promise<Unit> &&promise) {
|
void ContactsManager::set_business_away_message(BusinessAwayMessage &&away_message, Promise<Unit> &&promise) {
|
||||||
td_->create_handler<UpdateBusinessAwayMessageQuery>(std::move(promise))->send(std::move(away_message));
|
td_->create_handler<UpdateBusinessAwayMessageQuery>(std::move(promise))->send(std::move(away_message));
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,6 +472,8 @@ class ContactsManager final : public Actor {
|
||||||
|
|
||||||
void set_business_work_hours(BusinessWorkHours &&work_hours, Promise<Unit> &&promise);
|
void set_business_work_hours(BusinessWorkHours &&work_hours, Promise<Unit> &&promise);
|
||||||
|
|
||||||
|
void set_business_greeting_message(BusinessGreetingMessage &&greeting_message, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void set_business_away_message(BusinessAwayMessage &&away_message, Promise<Unit> &&promise);
|
void set_business_away_message(BusinessAwayMessage &&away_message, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void set_chat_description(ChatId chat_id, const string &description, Promise<Unit> &&promise);
|
void set_chat_description(ChatId chat_id, const string &description, Promise<Unit> &&promise);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "td/telegram/BotInfoManager.h"
|
#include "td/telegram/BotInfoManager.h"
|
||||||
#include "td/telegram/BotMenuButton.h"
|
#include "td/telegram/BotMenuButton.h"
|
||||||
#include "td/telegram/BusinessAwayMessage.h"
|
#include "td/telegram/BusinessAwayMessage.h"
|
||||||
|
#include "td/telegram/BusinessGreetingMessage.h"
|
||||||
#include "td/telegram/BusinessWorkHours.h"
|
#include "td/telegram/BusinessWorkHours.h"
|
||||||
#include "td/telegram/CallbackQueriesManager.h"
|
#include "td/telegram/CallbackQueriesManager.h"
|
||||||
#include "td/telegram/CallId.h"
|
#include "td/telegram/CallId.h"
|
||||||
|
@ -7778,6 +7779,13 @@ void Td::on_request(uint64 id, td_api::setBusinessWorkHours &request) {
|
||||||
contacts_manager_->set_business_work_hours(BusinessWorkHours(std::move(request.work_hours_)), std::move(promise));
|
contacts_manager_->set_business_work_hours(BusinessWorkHours(std::move(request.work_hours_)), std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Td::on_request(uint64 id, td_api::setBusinessGreetingMessageSettings &request) {
|
||||||
|
CHECK_IS_USER();
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
contacts_manager_->set_business_greeting_message(
|
||||||
|
BusinessGreetingMessage(std::move(request.greeting_message_settings_)), std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::setBusinessAwayMessageSettings &request) {
|
void Td::on_request(uint64 id, td_api::setBusinessAwayMessageSettings &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
|
|
@ -1380,6 +1380,8 @@ class Td final : public Actor {
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::setBusinessWorkHours &request);
|
void on_request(uint64 id, td_api::setBusinessWorkHours &request);
|
||||||
|
|
||||||
|
void on_request(uint64 id, td_api::setBusinessGreetingMessageSettings &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::setBusinessAwayMessageSettings &request);
|
void on_request(uint64 id, td_api::setBusinessAwayMessageSettings &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::setProfilePhoto &request);
|
void on_request(uint64 id, td_api::setProfilePhoto &request);
|
||||||
|
|
|
@ -5939,6 +5939,21 @@ class CliClient final : public Actor {
|
||||||
send_request(td_api::make_object<td_api::setBusinessWorkHours>(
|
send_request(td_api::make_object<td_api::setBusinessWorkHours>(
|
||||||
td_api::make_object<td_api::businessWorkHours>(time_zone_id, std::move(intervals))));
|
td_api::make_object<td_api::businessWorkHours>(time_zone_id, std::move(intervals))));
|
||||||
}
|
}
|
||||||
|
} else if (op == "sbgms") {
|
||||||
|
string shortcut_id;
|
||||||
|
string chat_ids;
|
||||||
|
int32 inactivity_days;
|
||||||
|
get_args(args, shortcut_id, chat_ids, inactivity_days);
|
||||||
|
if (shortcut_id.empty()) {
|
||||||
|
send_request(td_api::make_object<td_api::setBusinessGreetingMessageSettings>(nullptr));
|
||||||
|
} else {
|
||||||
|
send_request(td_api::make_object<td_api::setBusinessGreetingMessageSettings>(
|
||||||
|
td_api::make_object<td_api::businessGreetingMessageSettings>(
|
||||||
|
to_integer<int32>(shortcut_id),
|
||||||
|
td_api::make_object<td_api::businessRecipients>(as_chat_ids(chat_ids), rand_bool(), rand_bool(),
|
||||||
|
rand_bool(), rand_bool(), rand_bool()),
|
||||||
|
inactivity_days)));
|
||||||
|
}
|
||||||
} else if (op == "sbams") {
|
} else if (op == "sbams") {
|
||||||
string shortcut_id;
|
string shortcut_id;
|
||||||
string chat_ids;
|
string chat_ids;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user