Allow bots to send polls to private chats.

GitOrigin-RevId: c1e274b1f0b8a7c7eec8edc304976f8b07b25164
This commit is contained in:
levlam 2020-01-13 21:26:58 +03:00
parent 4e22f29c53
commit 656fda701f
2 changed files with 2 additions and 2 deletions

View File

@ -1562,7 +1562,7 @@ inputMessageGame bot_user_id:int32 game_short_name:string = InputMessageContent;
//@payload The invoice payload @provider_token Payment provider token @provider_data JSON-encoded data about the invoice, which will be shared with the payment provider @start_parameter Unique invoice bot start_parameter for the generation of this invoice
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 private or secret chats @question Poll question, 1-255 characters @options List of poll answer options, 2-10 strings 1-100 characters each
//@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent to private chats only by bots @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;

View File

@ -17785,7 +17785,7 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa
auto content_type = content->get_type();
switch (dialog_type) {
case DialogType::User:
if (content_type == MessageContentType::Poll && !is_forward) {
if (content_type == MessageContentType::Poll && !is_forward && !td_->auth_manager_->is_bot() && !is_via_bot) {
return Status::Error(400, "Polls can't be sent to private chats");
}
break;