Answer the question
In order to leave comments, you need to log in
Strange error?
@bot.message_handler(content_types=['text'])
def start(message):
if message.text == '/start':
markup = types.InlineKeyboardMarkup(row_width=1)
buttons =[
types.InlineKeyboardButton(
text='Обратить внимание',
callback_data='k1'
),
]
markup.add(*buttons)
bot.send_photo(message.from_user.id, img1, caption=text, reply_markup=markup)
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
try:
if call.message:
if call.data == 'k5':
markup = types.InlineKeyboardMarkup(row_width=1)
buttonssssfss =[
types.InlineKeyboardButton(
text='А ну давай',
url='@kulibenko'
),
]
markup.add(*buttonssssfss)
bot.send_photo(call.message.chat.id, img10, caption=text5, reply_markup=markup)
elif call.data == 'k6':
markup = types.InlineKeyboardMarkup(row_width=1)
butto =[
types.InlineKeyboardButton(
text='Ну удачи',
url='@kulibenko'
),
]
markup.add(*butto)
bot.send_photo(call.message.chat.id, img9, caption=text5, reply_markup=markup)
elif call.data == 'k1':
markup = types.InlineKeyboardMarkup(row_width=1)
buttonss =[
types.InlineKeyboardButton(
text='Сыграть ноктюрн',
callback_data='k2'
),
]
markup.add(*buttonss)
bot.send_photo(call.message.chat.id, img2, caption=text1, reply_markup=markup)
elif call.data == 'k2':
markup = types.InlineKeyboardMarkup(row_width=1)
buttonsss =[
types.InlineKeyboardButton(
text='Тыкнуть на кнопку',
callback_data='k3'
),
]
markup.add(*buttonsss)
bot.send_photo(call.message.chat.id, img3, caption=text2, reply_markup=markup)
elif call.data == 'k3':
markup = types.InlineKeyboardMarkup(row_width=1)
buttonssss =[
types.InlineKeyboardButton(
text='ну-ну',
callback_data='k4'
),
]
markup.add(*buttonssss)
bot.send_photo(call.message.chat.id, img4, caption=text3, reply_markup=markup)
elif call.data == 'k4':
markup = types.InlineKeyboardMarkup(row_width=1)
buttonsssss =[
types.InlineKeyboardButton(
text='Ну... Тебя не существует',
callback_data='k5'
),
]
markup.add(*buttonsssss)
bot.send_photo(call.message.chat.id, img5, caption=text4, reply_markup=markup)
elif call.data == 'k5':
markup = types.InlineKeyboardMarkup(row_width=1)
buttonssssfss =[
types.InlineKeyboardButton(
text='А ну давай',
url='@*******'
),
]
markup.add(*buttonssssfss)
bot.send_photo(call.message.chat.id, img10, caption=text5, reply_markup=markup)
else:
bot.send_message(message.from_user.id, 'что-то пошло не так')
except Exception as e:
print(repr(e))
Answer the question
In order to leave comments, you need to log in
You must not be opening the image file correctly. I added this code to the top:
with open('1.png','rb') as file:
img1 = file.read()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question