X
X
xxxfdd2020-12-09 18:58:55
Python
xxxfdd, 2020-12-09 18:58:55

How, when you click on / start, so that the bot does not send a new inline button?

I need that when I click on / start, the telegram bot does not duplicate the Inline button, that is, so that there is only one menu in how here, for example, you can watch the video https://youtu.be/3DNBTS_aH6s code but it is not working

@bot.message_handler(commands=['start'])
def start(message):

    try:
        chat_id = message.chat.id
        message_id = message.message_id
        markup = types.InlineKeyboardMarkup()
        button2 = types.InlineKeyboardButton(text='Пяторочка', callback_data='Pyaterochka')

        markup.row(button2)
        photo = 'https://blackbox.style/wp-content/uploads/7ee26ddf-033b-4e62-b5a2-1be6916e7959.jpg'
        media = types.InputMediaPhoto(photo, caption='Лиса')
        bot.edit_message_media(media=media, chat_id=chat_id, message_id=message_id, reply_markup=markup)


    except:
        kol = message.from_user.first_name

        bot.send_message(message.from_user.id, f'Привет {kol}❗ Рад тебя видеть в моём интернет магазине')

        markup_pyatochka = types.InlineKeyboardMarkup()
        button1 = types.InlineKeyboardButton(text='Пятерочка', callback_data='Pyaterochka')

        markup_pyatochka.row(button1)

        photo = 'https://blackbox.style/wp-content/uploads/d8cf722c-d164-4cb3-ad5f-3369941c4868.jpg'

        media = types.InputMediaPhoto(photo, caption='Енот')
        bot.send_photo(message.chat.id, photo, caption='Енот', reply_markup=markup_pyatochka)

Here is the error
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400 Description: Bad Request: message can't be edited

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2016-12-15
@dhat

because the width of 100vw does not include the right scroll bar. and you have it. use 100%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question