-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
30 lines (24 loc) · 1.04 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# # aiogram import
# from aiogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
# from aiogram.dispatcher import FSMContext
# # kode import
# from loader import dp, bot
# from utils import texts
# from .shazam import search_shazam
# @dp.message_handler(content_types=['text'], state='*')
# async def songs(message: Message, state: FSMContext):
# term = message.text
# songs_info = search_shazam(term, limit=10)
# if songs_info:
# keyboard = InlineKeyboardMarkup(row_width=5)
# for i, song in enumerate(songs_info):
# button = InlineKeyboardButton(text=str(i + 1), callback_data=f'songs_{i}')
# keyboard.insert(button)
# song_list = "\n".join(
# [f"{i+1}. {song['artist']} - {song['title']}"
# for i, song in enumerate(songs_info)]
# )
# await message.answer(f"{song_list}", reply_markup=keyboard)
# await state.update_data(songs_info=songs_info)
# else:
# await message.reply(texts.NOT_SONGS)