Return error if no chat types are allowed.

This commit is contained in:
levlam 2023-04-07 16:11:19 +03:00
parent b4676dc57a
commit d986f0237c

View File

@ -618,6 +618,9 @@ static Result<InlineKeyboardButton> get_inline_keyboard_button(tl_object_ptr<td_
if (target->allow_channel_chats_) { if (target->allow_channel_chats_) {
current_button.id |= InlineKeyboardButton::BROADCASTS_MASK; current_button.id |= InlineKeyboardButton::BROADCASTS_MASK;
} }
if (current_button.id == 0) {
return Status::Error(400, "At least one chat type must be allowed");
}
if (current_button.id == InlineKeyboardButton::FULL_MASK) { if (current_button.id == InlineKeyboardButton::FULL_MASK) {
current_button.id = 0; current_button.id = 0;
} }