Don't check bot_is_member and bot_administrator_rights.
This commit is contained in:
parent
a347eb4da3
commit
101afa286e
@ -6403,7 +6403,9 @@ shareUserWithBot chat_id:int53 message_id:int53 button_id:int32 shared_user_id:i
|
||||
//@message_id Identifier of the message with the button
|
||||
//@button_id Identifier of the button
|
||||
//@shared_chat_id Identifier of the shared chat
|
||||
//@only_check Pass true to check that the chat can be shared by the button instead of actually sharing it. If the chat can be shared, but the bot requested more rights in the chat than it have currently, then the rigts will be given automatically
|
||||
//@only_check Pass true to check that the chat can be shared by the button instead of actually sharing it. Doesn't check bot_is_member and bot_administrator_rights restrictions.
|
||||
//-If the bot must be a member, then all chats from getGroupsInCommon and all chats, where the user can add the bot, are suitable. In the latter case the bot will be automatically added to the chat.
|
||||
//-If the bot must be an administrator, then all chats, where the bot already has requested rights or can be added to administrators by the user, are suitable. In the latter case the bot will be automatically granted requested rights
|
||||
shareChatWithBot chat_id:int53 message_id:int53 button_id:int32 shared_chat_id:int53 only_check:Bool = Ok;
|
||||
|
||||
|
||||
|
@ -240,18 +240,18 @@ Status RequestedDialogType::check_shared_dialog(Td *td, DialogId dialog_id) cons
|
||||
bool can_invite_bot = status.can_invite_users() &&
|
||||
(status.is_administrator() || !td->contacts_manager_->is_channel_public(channel_id));
|
||||
if (!is_broadcast && bot_is_participant_) {
|
||||
// can't check that the bot is already participant, so check that the user can add it instead
|
||||
// can't synchronously check that the bot is already participant
|
||||
if (!can_invite_bot) {
|
||||
return Status::Error(400, "The bot can't be added to the chat");
|
||||
// return Status::Error(400, "The bot can't be added to the chat");
|
||||
}
|
||||
}
|
||||
if (restrict_user_administrator_rights_ && !status.has_all_administrator_rights(user_administrator_rights_)) {
|
||||
return Status::Error(400, "Not enough rights in the chat");
|
||||
}
|
||||
if (restrict_bot_administrator_rights_) {
|
||||
// can't check that the bot is already an administrator, so check that the user can promote it instead
|
||||
// can't synchronously check that the bot is already an administrator
|
||||
if (!can_invite_bot || !status.can_promote_members()) {
|
||||
return Status::Error(400, "The bot can't be promoted in the chat");
|
||||
// return Status::Error(400, "The bot can't be promoted in the chat");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user