Allow to send paid media only to channels.

This commit is contained in:
levlam 2024-06-25 13:39:19 +03:00
parent 031864db3e
commit 1f9062834c

View File

@ -3849,11 +3849,18 @@ Status can_send_message_content(DialogId dialog_id, const MessageContent *conten
} }
break; break;
case MessageContentType::PaidMedia: case MessageContentType::PaidMedia:
if (!permissions.can_send_photos() || !permissions.can_send_videos()) { if (is_forward) {
return Status::Error(400, "Not enough rights to send paid media to the chat"); if (!permissions.can_send_photos() || !permissions.can_send_videos()) {
} return Status::Error(400, "Not enough rights to send paid media to the chat");
if (dialog_type == DialogType::SecretChat) { }
return Status::Error(400, "Paid media can't be sent to secret chats"); if (dialog_type == DialogType::SecretChat) {
return Status::Error(400, "Paid media can't be sent to secret chats");
}
} else {
if (dialog_type != DialogType::Channel ||
!td->chat_manager_->is_broadcast_channel(dialog_id.get_channel_id())) {
return Status::Error(400, "Paid media can be sent only in channel chats");
}
} }
break; break;
case MessageContentType::Photo: case MessageContentType::Photo: