Update layer to 112.
GitOrigin-RevId: 9d18b24ce8aeb86624a61c04e55ca5b4a42634ce
This commit is contained in:
parent
5da08f8bb1
commit
bb75ea35da
@ -268,8 +268,9 @@ game id:int64 short_name:string title:string text:formattedText description:stri
|
||||
|
||||
//@description Describes a poll @id Unique poll identifier @question Poll question, 1-255 characters @options List of poll answer options
|
||||
//@total_voter_count Total number of voters, participating in the poll @recent_voter_user_ids User identifiers of recent voters, if the poll is non-anonymous
|
||||
//@is_anonymous True, if the poll is anonymous @type Type of the poll @is_closed True, if the poll is closed
|
||||
poll id:int64 question:string options:vector<pollOption> total_voter_count:int32 recent_voter_user_ids:vector<int32> is_anonymous:Bool type:PollType is_closed:Bool = Poll;
|
||||
//@is_anonymous True, if the poll is anonymous @type Type of the poll
|
||||
//@close_date Point in time (Unix timestamp) when the poll will be automatically closed @close_period Amount of time the poll will be active after creation, in seconds @is_closed True, if the poll is closed
|
||||
poll id:int64 question:string options:vector<pollOption> total_voter_count:int32 recent_voter_user_ids:vector<int32> is_anonymous:Bool type:PollType close_date:int32 close_period:int32 is_closed:Bool = Poll;
|
||||
|
||||
|
||||
//@description Describes a user profile photo @id Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of userProfilePhotos
|
||||
@ -1592,8 +1593,11 @@ inputMessageGame bot_user_id:int32 game_short_name:string = InputMessageContent;
|
||||
inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string = InputMessageContent;
|
||||
|
||||
//@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot @question Poll question, 1-255 characters @options List of poll answer options, 2-10 strings 1-100 characters each
|
||||
//@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels @type Type of the poll @is_closed True, if the poll needs to be sent already closed; for bots only
|
||||
inputMessagePoll question:string options:vector<string> is_anonymous:Bool type:PollType is_closed:Bool = InputMessageContent;
|
||||
//@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels @type Type of the poll
|
||||
//@close_date Point in time (Unix timestamp) when the poll will be automatically closed; for bots only
|
||||
//@close_period Amount of time the poll will be active after creation, in seconds; for bots only
|
||||
//@is_closed True, if the poll needs to be sent already closed; for bots only
|
||||
inputMessagePoll question:string options:vector<string> is_anonymous:Bool type:PollType close_date:int32 close_period:int32 is_closed:Bool = InputMessageContent;
|
||||
|
||||
//@description A forwarded message @from_chat_id Identifier for the chat this forwarded message came from @message_id Identifier of the message to forward
|
||||
//@in_game_share True, if a game message should be shared within a launched game; applies only to game messages
|
||||
|
Binary file not shown.
@ -58,7 +58,7 @@ inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int =
|
||||
inputMediaGame#d33f43f3 id:InputGame = InputMedia;
|
||||
inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia;
|
||||
inputMediaGeoLive#ce4e82fd flags:# stopped:flags.0?true geo_point:InputGeoPoint period:flags.1?int = InputMedia;
|
||||
inputMediaPoll#abe9ca25 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> = InputMedia;
|
||||
inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector<bytes> solution:flags.1?string solution_entities:flags.1?Vector<MessageEntity> = InputMedia;
|
||||
inputMediaDice#aeffa807 = InputMedia;
|
||||
|
||||
inputChatPhotoEmpty#1ca48f57 = InputChatPhoto;
|
||||
@ -1011,11 +1011,11 @@ help.userInfo#1eb3758 message:string entities:Vector<MessageEntity> author:strin
|
||||
|
||||
pollAnswer#6ca9c2e9 text:string option:bytes = PollAnswer;
|
||||
|
||||
poll#d5529d06 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector<PollAnswer> = Poll;
|
||||
poll#86e18161 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector<PollAnswer> close_period:flags.4?int close_date:flags.5?int = Poll;
|
||||
|
||||
pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters;
|
||||
|
||||
pollResults#c87024a2 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<int> = PollResults;
|
||||
pollResults#badcc1a3 flags:# min:flags.0?true results:flags.1?Vector<PollAnswerVoters> total_voters:flags.2?int recent_voters:flags.3?Vector<int> solution:flags.4?string solution_entities:flags.4?Vector<MessageEntity> = PollResults;
|
||||
|
||||
chatOnlines#f041e250 onlines:int = ChatOnlines;
|
||||
|
||||
@ -1131,7 +1131,7 @@ stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueA
|
||||
|
||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||
invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector<long> query:!X = X;
|
||||
initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X;
|
||||
initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;
|
||||
invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
|
||||
invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;
|
||||
invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X;
|
||||
@ -1480,5 +1480,5 @@ langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLangua
|
||||
folders.editPeerFolders#6847d0ab folder_peers:Vector<InputFolderPeer> = Updates;
|
||||
folders.deleteFolder#1c295881 folder_id:int = Updates;
|
||||
|
||||
stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats;
|
||||
stats.getBroadcastStats#e6300dba flags:# dark:flags.0?true channel:InputChannel tz_offset:int = stats.BroadcastStats;
|
||||
stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
|
||||
|
Binary file not shown.
@ -2754,7 +2754,7 @@ class GetBroadcastStatsQuery : public Td::ResultHandler {
|
||||
flags |= telegram_api::stats_getBroadcastStats::DARK_MASK;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::stats_getBroadcastStats(flags, false /*ignored*/, std::move(input_channel)), dc_id));
|
||||
telegram_api::stats_getBroadcastStats(flags, false /*ignored*/, std::move(input_channel), 0), dc_id));
|
||||
}
|
||||
|
||||
void on_result(uint64 id, BufferSlice packet) override {
|
||||
|
@ -1771,10 +1771,15 @@ static Result<InputMessageContent> create_input_message_content(
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
int32 close_period = is_bot ? input_poll->close_period_ : 0;
|
||||
int32 close_date = is_bot ? input_poll->close_date_ : 0;
|
||||
if (close_period != 0) {
|
||||
close_date = 0;
|
||||
}
|
||||
bool is_closed = is_bot ? input_poll->is_closed_ : false;
|
||||
content = make_unique<MessagePoll>(td->poll_manager_->create_poll(
|
||||
std::move(input_poll->question_), std::move(input_poll->options_), input_poll->is_anonymous_,
|
||||
allow_multiple_answers, is_quiz, correct_option_id, is_closed));
|
||||
allow_multiple_answers, is_quiz, correct_option_id, close_date, close_period, is_closed));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -201,8 +201,8 @@ class StopPollActor : public NetActorOnce {
|
||||
auto message_id = full_message_id.get_message_id().get_server_message_id().get();
|
||||
auto poll = telegram_api::make_object<telegram_api::poll>();
|
||||
poll->flags_ |= telegram_api::poll::CLOSED_MASK;
|
||||
auto input_media =
|
||||
telegram_api::make_object<telegram_api::inputMediaPoll>(0, std::move(poll), vector<BufferSlice>());
|
||||
auto input_media = telegram_api::make_object<telegram_api::inputMediaPoll>(0, std::move(poll),
|
||||
vector<BufferSlice>(), string(), Auto());
|
||||
auto query = G()->net_query_creator().create(telegram_api::messages_editMessage(
|
||||
flags, false /*ignored*/, std::move(input_peer), message_id, string(), std::move(input_media),
|
||||
std::move(input_reply_markup), vector<tl_object_ptr<telegram_api::MessageEntity>>(), 0));
|
||||
@ -536,10 +536,23 @@ td_api::object_ptr<td_api::poll> PollManager::get_poll_object(PollId poll_id, co
|
||||
poll_type = td_api::make_object<td_api::pollTypeRegular>(poll->allow_multiple_answers);
|
||||
}
|
||||
|
||||
auto close_date = poll->close_date;
|
||||
auto close_period = poll->close_period;
|
||||
if (close_period != 0 && close_date == 0) {
|
||||
close_date = G()->unix_time() + close_period;
|
||||
}
|
||||
if (close_period == 0 && close_date != 0) {
|
||||
auto now = G()->unix_time();
|
||||
if (close_date < now + 5) {
|
||||
close_date = 0;
|
||||
} else {
|
||||
close_period = close_date - now;
|
||||
}
|
||||
}
|
||||
return td_api::make_object<td_api::poll>(
|
||||
poll_id.get(), poll->question, std::move(poll_options), total_voter_count,
|
||||
td_->contacts_manager_->get_user_ids_object(poll->recent_voter_user_ids, "get_poll_object"), poll->is_anonymous,
|
||||
std::move(poll_type), poll->is_closed);
|
||||
std::move(poll_type), close_date, close_period, poll->is_closed);
|
||||
}
|
||||
|
||||
telegram_api::object_ptr<telegram_api::pollAnswer> PollManager::get_input_poll_option(const PollOption &poll_option) {
|
||||
@ -547,7 +560,8 @@ telegram_api::object_ptr<telegram_api::pollAnswer> PollManager::get_input_poll_o
|
||||
}
|
||||
|
||||
PollId PollManager::create_poll(string &&question, vector<string> &&options, bool is_anonymous,
|
||||
bool allow_multiple_answers, bool is_quiz, int32 correct_option_id, bool is_closed) {
|
||||
bool allow_multiple_answers, bool is_quiz, int32 correct_option_id, int32 close_date,
|
||||
int32 close_period, bool is_closed) {
|
||||
auto poll = make_unique<Poll>();
|
||||
poll->question = std::move(question);
|
||||
int pos = '0';
|
||||
@ -561,6 +575,8 @@ PollId PollManager::create_poll(string &&question, vector<string> &&options, boo
|
||||
poll->allow_multiple_answers = allow_multiple_answers;
|
||||
poll->is_quiz = is_quiz;
|
||||
poll->correct_option_id = correct_option_id;
|
||||
poll->close_date = close_date;
|
||||
poll->close_period = close_period;
|
||||
poll->is_closed = is_closed;
|
||||
|
||||
PollId poll_id(--current_local_poll_id_);
|
||||
@ -1163,6 +1179,12 @@ tl_object_ptr<telegram_api::InputMedia> PollManager::get_input_media(PollId poll
|
||||
if (poll->is_quiz) {
|
||||
poll_flags |= telegram_api::poll::QUIZ_MASK;
|
||||
}
|
||||
if (poll->close_date != 0) {
|
||||
poll_flags |= telegram_api::poll::CLOSE_DATE_MASK;
|
||||
}
|
||||
if (poll->close_period != 0) {
|
||||
poll_flags |= telegram_api::poll::CLOSE_PERIOD_MASK;
|
||||
}
|
||||
if (poll->is_closed) {
|
||||
poll_flags |= telegram_api::poll::CLOSED_MASK;
|
||||
}
|
||||
@ -1177,10 +1199,10 @@ tl_object_ptr<telegram_api::InputMedia> PollManager::get_input_media(PollId poll
|
||||
}
|
||||
return telegram_api::make_object<telegram_api::inputMediaPoll>(
|
||||
flags,
|
||||
telegram_api::make_object<telegram_api::poll>(0, poll_flags, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, false /*ignored*/, poll->question,
|
||||
transform(poll->options, get_input_poll_option)),
|
||||
std::move(correct_answers));
|
||||
telegram_api::make_object<telegram_api::poll>(
|
||||
0, poll_flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, poll->question,
|
||||
transform(poll->options, get_input_poll_option), poll->close_period, poll->close_date),
|
||||
std::move(correct_answers), string(), Auto());
|
||||
}
|
||||
|
||||
vector<PollManager::PollOption> PollManager::get_poll_options(
|
||||
@ -1246,6 +1268,21 @@ PollId PollManager::on_get_poll(PollId poll_id, tl_object_ptr<telegram_api::poll
|
||||
}
|
||||
}
|
||||
}
|
||||
int32 close_date = (poll_server->flags_ & telegram_api::poll::CLOSE_DATE_MASK) != 0 ? poll_server->close_date_ : 0;
|
||||
int32 close_period =
|
||||
(poll_server->flags_ & telegram_api::poll::CLOSE_PERIOD_MASK) != 0 ? poll_server->close_period_ : 0;
|
||||
if (close_date == 0 || close_period == 0) {
|
||||
close_date = 0;
|
||||
close_period = 0;
|
||||
}
|
||||
if (close_date != poll->close_date) {
|
||||
poll->close_date = close_date;
|
||||
is_changed = true;
|
||||
}
|
||||
if (close_period != poll->close_period) {
|
||||
poll->close_period = close_period;
|
||||
is_changed = true;
|
||||
}
|
||||
bool is_closed = (poll_server->flags_ & telegram_api::poll::CLOSED_MASK) != 0;
|
||||
if (is_closed && !poll->is_closed) {
|
||||
poll->is_closed = is_closed;
|
||||
|
@ -45,7 +45,7 @@ class PollManager : public Actor {
|
||||
static bool is_local_poll_id(PollId poll_id);
|
||||
|
||||
PollId create_poll(string &&question, vector<string> &&options, bool is_anonymous, bool allow_multiple_answers,
|
||||
bool is_quiz, int32 correct_option_id, bool is_closed);
|
||||
bool is_quiz, int32 correct_option_id, int32 close_date, int32 close_period, bool is_closed);
|
||||
|
||||
void register_poll(PollId poll_id, FullMessageId full_message_id, const char *source);
|
||||
|
||||
@ -108,6 +108,8 @@ class PollManager : public Actor {
|
||||
vector<UserId> recent_voter_user_ids;
|
||||
int32 total_voter_count = 0;
|
||||
int32 correct_option_id = -1;
|
||||
int32 close_date = 0;
|
||||
int32 close_period = 0;
|
||||
bool is_anonymous = true;
|
||||
bool allow_multiple_answers = false;
|
||||
bool is_quiz = false;
|
||||
|
@ -44,12 +44,16 @@ void PollManager::Poll::store(StorerT &storer) const {
|
||||
using ::td::store;
|
||||
bool is_public = !is_anonymous;
|
||||
bool has_recent_voters = !recent_voter_user_ids.empty();
|
||||
bool has_close_date = close_date != 0;
|
||||
bool has_close_period = close_period != 0;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_closed);
|
||||
STORE_FLAG(is_public);
|
||||
STORE_FLAG(allow_multiple_answers);
|
||||
STORE_FLAG(is_quiz);
|
||||
STORE_FLAG(has_recent_voters);
|
||||
STORE_FLAG(has_close_date);
|
||||
STORE_FLAG(has_close_period);
|
||||
END_STORE_FLAGS();
|
||||
|
||||
store(question, storer);
|
||||
@ -61,6 +65,12 @@ void PollManager::Poll::store(StorerT &storer) const {
|
||||
if (has_recent_voters) {
|
||||
store(recent_voter_user_ids, storer);
|
||||
}
|
||||
if (has_close_date) {
|
||||
store(close_date, storer);
|
||||
}
|
||||
if (has_close_period) {
|
||||
store(close_period, storer);
|
||||
}
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
@ -68,12 +78,16 @@ void PollManager::Poll::parse(ParserT &parser) {
|
||||
using ::td::parse;
|
||||
bool is_public;
|
||||
bool has_recent_voters;
|
||||
bool has_close_date;
|
||||
bool has_close_period;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_closed);
|
||||
PARSE_FLAG(is_public);
|
||||
PARSE_FLAG(allow_multiple_answers);
|
||||
PARSE_FLAG(is_quiz);
|
||||
PARSE_FLAG(has_recent_voters);
|
||||
PARSE_FLAG(has_close_date);
|
||||
PARSE_FLAG(has_close_period);
|
||||
END_PARSE_FLAGS();
|
||||
is_anonymous = !is_public;
|
||||
|
||||
@ -89,6 +103,12 @@ void PollManager::Poll::parse(ParserT &parser) {
|
||||
if (has_recent_voters) {
|
||||
parse(recent_voter_user_ids, parser);
|
||||
}
|
||||
if (has_close_date) {
|
||||
parse(close_date, parser);
|
||||
}
|
||||
if (has_close_period) {
|
||||
parse(close_period, parser);
|
||||
}
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
@ -97,11 +117,15 @@ void PollManager::store_poll(PollId poll_id, StorerT &storer) const {
|
||||
if (is_local_poll_id(poll_id)) {
|
||||
auto poll = get_poll(poll_id);
|
||||
CHECK(poll != nullptr);
|
||||
bool has_close_date = poll->close_date != 0;
|
||||
bool has_close_period = poll->close_period != 0;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(poll->is_closed);
|
||||
STORE_FLAG(poll->is_anonymous);
|
||||
STORE_FLAG(poll->allow_multiple_answers);
|
||||
STORE_FLAG(poll->is_quiz);
|
||||
STORE_FLAG(has_close_date);
|
||||
STORE_FLAG(has_close_period);
|
||||
END_STORE_FLAGS();
|
||||
store(poll->question, storer);
|
||||
vector<string> options = transform(poll->options, [](const PollOption &option) { return option.text; });
|
||||
@ -109,6 +133,12 @@ void PollManager::store_poll(PollId poll_id, StorerT &storer) const {
|
||||
if (poll->is_quiz) {
|
||||
store(poll->correct_option_id, storer);
|
||||
}
|
||||
if (has_close_date) {
|
||||
store(poll->close_date, storer);
|
||||
}
|
||||
if (has_close_period) {
|
||||
store(poll->close_period, storer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,10 +150,14 @@ PollId PollManager::parse_poll(ParserT &parser) {
|
||||
if (is_local_poll_id(poll_id)) {
|
||||
string question;
|
||||
vector<string> options;
|
||||
int32 close_date = 0;
|
||||
int32 close_period = 0;
|
||||
bool is_closed = false;
|
||||
bool is_anonymous = true;
|
||||
bool allow_multiple_answers = false;
|
||||
bool is_quiz = false;
|
||||
bool has_close_date = false;
|
||||
bool has_close_period = false;
|
||||
int32 correct_option_id = -1;
|
||||
|
||||
if (parser.version() >= static_cast<int32>(Version::SupportPolls2_0)) {
|
||||
@ -132,6 +166,8 @@ PollId PollManager::parse_poll(ParserT &parser) {
|
||||
PARSE_FLAG(is_anonymous);
|
||||
PARSE_FLAG(allow_multiple_answers);
|
||||
PARSE_FLAG(is_quiz);
|
||||
PARSE_FLAG(has_close_date);
|
||||
PARSE_FLAG(has_close_period);
|
||||
END_PARSE_FLAGS();
|
||||
}
|
||||
parse(question, parser);
|
||||
@ -142,11 +178,17 @@ PollId PollManager::parse_poll(ParserT &parser) {
|
||||
parser.set_error("Wrong correct_option_id");
|
||||
}
|
||||
}
|
||||
if (has_close_date) {
|
||||
parse(close_date, parser);
|
||||
}
|
||||
if (has_close_period) {
|
||||
parse(close_period, parser);
|
||||
}
|
||||
if (parser.get_error() != nullptr) {
|
||||
return PollId();
|
||||
}
|
||||
return create_poll(std::move(question), std::move(options), is_anonymous, allow_multiple_answers, is_quiz,
|
||||
correct_option_id, is_closed);
|
||||
correct_option_id, close_date, close_period, is_closed);
|
||||
}
|
||||
|
||||
auto poll = get_poll_force(poll_id);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
constexpr int32 MTPROTO_LAYER = 111;
|
||||
constexpr int32 MTPROTO_LAYER = 112;
|
||||
|
||||
enum class Version : int32 {
|
||||
Initial,
|
||||
|
@ -3232,7 +3232,7 @@ class CliClient final : public Actor {
|
||||
poll_type = td_api::make_object<td_api::pollTypeRegular>(op == "spollm");
|
||||
}
|
||||
send_message(chat_id, td_api::make_object<td_api::inputMessagePoll>(question, std::move(options), op != "spollp",
|
||||
std::move(poll_type), false));
|
||||
std::move(poll_type), 0, 0, false));
|
||||
} else if (op == "sp" || op == "spcaption" || op == "spttl") {
|
||||
string chat_id;
|
||||
string photo_path;
|
||||
|
Loading…
Reference in New Issue
Block a user