Allow bots to send closed polls.

GitOrigin-RevId: 9ba80686140dd2a9d909a9f7add53a8cd69bea90
This commit is contained in:
levlam 2020-01-21 18:09:15 +03:00
parent 8366da5ca1
commit 32b3a75676
5 changed files with 7 additions and 4 deletions

View File

@ -1566,8 +1566,8 @@ 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
inputMessagePoll question:string options:vector<string> is_anonymous:Bool type:PollType = 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 @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;
//@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.

View File

@ -1833,7 +1833,7 @@ static Result<InputMessageContent> create_input_message_content(
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, false));
allow_multiple_answers, is_quiz, correct_option_id, input_poll->is_closed_));
break;
}
default:

View File

@ -1139,6 +1139,9 @@ 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->is_closed) {
poll_flags |= telegram_api::poll::CLOSED_MASK;
}
int32 flags = 0;
vector<BufferSlice> correct_answers;

View File

@ -3208,7 +3208,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)));
std::move(poll_type), false));
} else if (op == "sp" || op == "spcaption" || op == "spttl") {
string chat_id;
string photo_path;