Add td_api::activateStoryStealthMode.
This commit is contained in:
parent
a9f6f897c6
commit
ea33e9f2d0
@ -7473,6 +7473,10 @@ getStoryViewers story_id:int32 offset_viewer:messageViewer limit:int32 = Message
|
|||||||
//@text Additional report details; 0-1024 characters
|
//@text Additional report details; 0-1024 characters
|
||||||
reportStory story_sender_chat_id:int53 story_id:int32 reason:ReportReason text:string = Ok;
|
reportStory story_sender_chat_id:int53 story_id:int32 reason:ReportReason text:string = Ok;
|
||||||
|
|
||||||
|
//@description Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds
|
||||||
|
//-and for the next "story_stealth_mode_future_period" seconds; for Telegram Premium users only
|
||||||
|
activateStoryStealthMode = Ok;
|
||||||
|
|
||||||
|
|
||||||
//@description Returns information about a bot that can be added to attachment menu @bot_user_id Bot's user identifier
|
//@description Returns information about a bot that can be added to attachment menu @bot_user_id Bot's user identifier
|
||||||
getAttachmentMenuBot bot_user_id:int53 = AttachmentMenuBot;
|
getAttachmentMenuBot bot_user_id:int53 = AttachmentMenuBot;
|
||||||
|
@ -556,6 +556,37 @@ class ReportStoryQuery final : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ActivateStealthModeQuery final : public Td::ResultHandler {
|
||||||
|
Promise<Unit> promise_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ActivateStealthModeQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void send() {
|
||||||
|
int32 flags =
|
||||||
|
telegram_api::stories_activateStealthMode::PAST_MASK | telegram_api::stories_activateStealthMode::FUTURE_MASK;
|
||||||
|
|
||||||
|
send_query(G()->net_query_creator().create(
|
||||||
|
telegram_api::stories_activateStealthMode(flags, false /*ignored*/, false /*ignored*/)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_result(BufferSlice packet) final {
|
||||||
|
auto result_ptr = fetch_result<telegram_api::stories_activateStealthMode>(packet);
|
||||||
|
if (result_ptr.is_error()) {
|
||||||
|
return on_error(result_ptr.move_as_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ptr = result_ptr.move_as_ok();
|
||||||
|
LOG(INFO) << "Receive result for ActivateStealthModeQuery: " << to_string(ptr);
|
||||||
|
td_->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_error(Status status) final {
|
||||||
|
promise_.set_error(std::move(status));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class StoryManager::SendStoryQuery final : public Td::ResultHandler {
|
class StoryManager::SendStoryQuery final : public Td::ResultHandler {
|
||||||
FileId file_id_;
|
FileId file_id_;
|
||||||
unique_ptr<PendingStory> pending_story_;
|
unique_ptr<PendingStory> pending_story_;
|
||||||
@ -2265,6 +2296,10 @@ void StoryManager::report_story(StoryFullId story_full_id, ReportReason &&reason
|
|||||||
td_->create_handler<ReportStoryQuery>(std::move(promise))->send(story_full_id, std::move(reason));
|
td_->create_handler<ReportStoryQuery>(std::move(promise))->send(story_full_id, std::move(reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StoryManager::activate_stealth_mode(Promise<Unit> &&promise) {
|
||||||
|
td_->create_handler<ActivateStealthModeQuery>(std::move(promise))->send();
|
||||||
|
}
|
||||||
|
|
||||||
bool StoryManager::have_story(StoryFullId story_full_id) const {
|
bool StoryManager::have_story(StoryFullId story_full_id) const {
|
||||||
return get_story(story_full_id) != nullptr;
|
return get_story(story_full_id) != nullptr;
|
||||||
}
|
}
|
||||||
|
@ -249,6 +249,8 @@ class StoryManager final : public Actor {
|
|||||||
|
|
||||||
void report_story(StoryFullId story_full_id, ReportReason &&reason, Promise<Unit> &&promise);
|
void report_story(StoryFullId story_full_id, ReportReason &&reason, Promise<Unit> &&promise);
|
||||||
|
|
||||||
|
void activate_stealth_mode(Promise<Unit> &&promise);
|
||||||
|
|
||||||
void remove_story_notifications_by_story_ids(DialogId dialog_id, const vector<StoryId> &story_ids);
|
void remove_story_notifications_by_story_ids(DialogId dialog_id, const vector<StoryId> &story_ids);
|
||||||
|
|
||||||
StoryId on_get_story(DialogId owner_dialog_id, telegram_api::object_ptr<telegram_api::StoryItem> &&story_item_ptr);
|
StoryId on_get_story(DialogId owner_dialog_id, telegram_api::object_ptr<telegram_api::StoryItem> &&story_item_ptr);
|
||||||
|
@ -6502,6 +6502,11 @@ void Td::on_request(uint64 id, td_api::reportStory &request) {
|
|||||||
r_report_reason.move_as_ok(), std::move(promise));
|
r_report_reason.move_as_ok(), std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Td::on_request(uint64 id, const td_api::activateStoryStealthMode &request) {
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
story_manager_->activate_stealth_mode(std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::getAttachmentMenuBot &request) {
|
void Td::on_request(uint64 id, const td_api::getAttachmentMenuBot &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CREATE_REQUEST_PROMISE();
|
CREATE_REQUEST_PROMISE();
|
||||||
|
@ -1025,6 +1025,8 @@ class Td final : public Actor {
|
|||||||
|
|
||||||
void on_request(uint64 id, td_api::reportStory &request);
|
void on_request(uint64 id, td_api::reportStory &request);
|
||||||
|
|
||||||
|
void on_request(uint64 id, const td_api::activateStoryStealthMode &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::getAttachmentMenuBot &request);
|
void on_request(uint64 id, const td_api::getAttachmentMenuBot &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::toggleBotIsAddedToAttachmentMenu &request);
|
void on_request(uint64 id, const td_api::toggleBotIsAddedToAttachmentMenu &request);
|
||||||
|
@ -4155,6 +4155,8 @@ class CliClient final : public Actor {
|
|||||||
string text;
|
string text;
|
||||||
get_args(args, story_sender_chat_id, story_id, reason, text);
|
get_args(args, story_sender_chat_id, story_id, reason, text);
|
||||||
send_request(td_api::make_object<td_api::reportStory>(story_sender_chat_id, story_id, reason, text));
|
send_request(td_api::make_object<td_api::reportStory>(story_sender_chat_id, story_id, reason, text));
|
||||||
|
} else if (op == "assm") {
|
||||||
|
send_request(td_api::make_object<td_api::activateStoryStealthMode>());
|
||||||
} else if (op == "gamb") {
|
} else if (op == "gamb") {
|
||||||
UserId user_id;
|
UserId user_id;
|
||||||
get_args(args, user_id);
|
get_args(args, user_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user