Add td_api::setBusinessAwayMessageSettings.
This commit is contained in:
parent
44bdcd4920
commit
66761d1950
@ -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 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;
|
||||||
|
|
||||||
//@description Changes the phone number of the user and sends an authentication code to the user's new phone number; for official Android and iOS applications only. On success, returns information about the sent code
|
//@description Changes the phone number of the user and sends an authentication code to the user's new phone number; for official Android and iOS applications only. On success, returns information about the sent code
|
||||||
//@phone_number The new phone number of the user in international format
|
//@phone_number The new phone number of the user in international format
|
||||||
//@settings Settings for the authentication of the user's phone number; pass null to use default settings
|
//@settings Settings for the authentication of the user's phone number; pass null to use default settings
|
||||||
|
@ -1167,6 +1167,41 @@ class UpdateBusinessWorkHoursQuery final : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class UpdateBusinessAwayMessageQuery final : public Td::ResultHandler {
|
||||||
|
Promise<Unit> promise_;
|
||||||
|
BusinessAwayMessage away_message_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit UpdateBusinessAwayMessageQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void send(BusinessAwayMessage &&away_message) {
|
||||||
|
away_message_ = std::move(away_message);
|
||||||
|
int32 flags = 0;
|
||||||
|
if (!away_message_.is_empty()) {
|
||||||
|
flags |= telegram_api::account_updateBusinessAwayMessage::MESSAGE_MASK;
|
||||||
|
}
|
||||||
|
send_query(G()->net_query_creator().create(
|
||||||
|
telegram_api::account_updateBusinessAwayMessage(flags, away_message_.get_input_business_away_message(td_)),
|
||||||
|
{{"me"}}));
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_result(BufferSlice packet) final {
|
||||||
|
auto result_ptr = fetch_result<telegram_api::account_updateBusinessAwayMessage>(packet);
|
||||||
|
if (result_ptr.is_error()) {
|
||||||
|
return on_error(result_ptr.move_as_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
td_->contacts_manager_->on_update_user_away_message(td_->contacts_manager_->get_my_id(), std::move(away_message_));
|
||||||
|
|
||||||
|
promise_.set_value(Unit());
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_error(Status status) final {
|
||||||
|
promise_.set_error(std::move(status));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class CreateChatQuery final : public Td::ResultHandler {
|
class CreateChatQuery final : public Td::ResultHandler {
|
||||||
Promise<td_api::object_ptr<td_api::chat>> promise_;
|
Promise<td_api::object_ptr<td_api::chat>> promise_;
|
||||||
|
|
||||||
@ -7029,6 +7064,10 @@ 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_away_message(BusinessAwayMessage &&away_message, Promise<Unit> &&promise) {
|
||||||
|
td_->create_handler<UpdateBusinessAwayMessageQuery>(std::move(promise))->send(std::move(away_message));
|
||||||
|
}
|
||||||
|
|
||||||
void ContactsManager::set_chat_description(ChatId chat_id, const string &description, Promise<Unit> &&promise) {
|
void ContactsManager::set_chat_description(ChatId chat_id, const string &description, Promise<Unit> &&promise) {
|
||||||
auto new_description = strip_empty_characters(description, MAX_DESCRIPTION_LENGTH);
|
auto new_description = strip_empty_characters(description, MAX_DESCRIPTION_LENGTH);
|
||||||
auto c = get_chat(chat_id);
|
auto c = get_chat(chat_id);
|
||||||
|
@ -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_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);
|
||||||
|
|
||||||
void set_channel_username(ChannelId channel_id, const string &username, Promise<Unit> &&promise);
|
void set_channel_username(ChannelId channel_id, const string &username, Promise<Unit> &&promise);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "td/telegram/BotCommand.h"
|
#include "td/telegram/BotCommand.h"
|
||||||
#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/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"
|
||||||
@ -7777,6 +7778,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::setBusinessAwayMessageSettings &request) {
|
||||||
|
CHECK_IS_USER();
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
contacts_manager_->set_business_away_message(BusinessAwayMessage(std::move(request.away_message_settings_)),
|
||||||
|
std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::setProfilePhoto &request) {
|
void Td::on_request(uint64 id, td_api::setProfilePhoto &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::setBusinessAwayMessageSettings &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::setProfilePhoto &request);
|
void on_request(uint64 id, td_api::setProfilePhoto &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::deleteProfilePhoto &request);
|
void on_request(uint64 id, const td_api::deleteProfilePhoto &request);
|
||||||
|
@ -5939,6 +5939,31 @@ 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 == "sbams") {
|
||||||
|
string shortcut_id;
|
||||||
|
string chat_ids;
|
||||||
|
string schedule;
|
||||||
|
get_args(args, shortcut_id, chat_ids, schedule);
|
||||||
|
if (shortcut_id.empty()) {
|
||||||
|
send_request(td_api::make_object<td_api::setBusinessAwayMessageSettings>(nullptr));
|
||||||
|
} else {
|
||||||
|
td_api::object_ptr<td_api::BusinessAwayMessageSchedule> schedule_object;
|
||||||
|
if (schedule[0] == 'o') {
|
||||||
|
schedule_object = td_api::make_object<td_api::businessAwayMessageScheduleOffline>();
|
||||||
|
} else if (schedule[0] == 'h') {
|
||||||
|
schedule_object = td_api::make_object<td_api::businessAwayMessageScheduleOutsideOfWorkHours>();
|
||||||
|
} else {
|
||||||
|
auto start_date = to_integer<int32>(schedule);
|
||||||
|
schedule_object = td_api::make_object<td_api::businessAwayMessageScheduleCustom>(
|
||||||
|
start_date, start_date + Random::fast(1000, 100000));
|
||||||
|
}
|
||||||
|
send_request(td_api::make_object<td_api::setBusinessAwayMessageSettings>(
|
||||||
|
td_api::make_object<td_api::businessAwayMessageSettings>(
|
||||||
|
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()),
|
||||||
|
std::move(schedule_object))));
|
||||||
|
}
|
||||||
} else if (op == "sco") {
|
} else if (op == "sco") {
|
||||||
SearchQuery query;
|
SearchQuery query;
|
||||||
get_args(args, query);
|
get_args(args, query);
|
||||||
|
Loading…
Reference in New Issue
Block a user