if message.text == 'Сервера':
keyboard = telebot.types.ReplyKeyboardMarkup(True)
keyboard.add('Первый', 'Второй', 'Третий')
bot.send_message(message.from_user.id, 'Выбери сервер', reply_markup=keyboard)
@dp.message_handler(commands=['test'])
async def cmd_image(message: types.Message):
with open('/storage/emulated/0/Movies/3e36b80b873e29689147792373da5934.mp4', 'rb') as video:
await message.answer_video(video)
buttons = []
for number in range(9, 17):
buttons.append(InlineKeyboardButton(f"{s[number][0]}", callback_data=f"tr{number+1}"))
........
tradeee.add(*buttons)
stroka = 'Время до отключения 1 минута 10 секунд'
stroka_list = stroka.split() #получим ['Время', 'до', 'отключения', '1', 'минута', '10', 'секунд']
a1 = int(stroka_list[3])
a2 = int(stroka_list[5])
dct = {1: [1, 2, 3, 4, 5], 2:[1, 2, 3], 3:[1, 2, 3, 4, 5, 6, 7, 8, 9], 4:[1, 2, 3, 4, 5, 6, 7, 8], 5:[1, 2, 3, 4, 5, 6, 7, 8, 9]}
list_dct = list(dct.items())
list_dct.sort(key=lambda i: len(i[1]))
for i in list_dct:
print(i[0], ':', i[1])
# Вывод:
# 2 : [1, 2, 3]
# 1 : [1, 2, 3, 4, 5]
# 4 : [1, 2, 3, 4, 5, 6, 7, 8]
# 3 : [1, 2, 3, 4, 5, 6, 7, 8, 9]
# 5 : [1, 2, 3, 4, 5, 6, 7, 8, 9]
update_types=['edited_message']
@bot.middleware_handler(update_types=['edited_message'])
def foo(bot_instanse, message):
print(message)