Files
AnyMusicBot/bot/keyboards/inline/search_variants.py
2024-11-02 00:10:44 +02:00

34 lines
824 B
Python

from aiogram.utils.keyboard import (
InlineKeyboardBuilder,
InlineKeyboardButton,
InlineKeyboardMarkup,
)
deezer = {"d": "🎵 Search in Deezer"}
soundcloud = {"c": "☁️ Search in SoundCloud"}
youtube = {"y": "▶️ Search in YouTube"}
spotify = {"s": "🎧 Search in Spotify"}
def get_search_variants(
query: str,
services: dict[str, str],
) -> list[list[InlineKeyboardButton]]:
buttons = [
[
InlineKeyboardButton(
text=services[key], switch_inline_query_current_chat=f"{key}:{query}"
)
]
for key in services.keys()
]
return buttons
def get_search_variants_kb(
query: str,
services: dict[str, str],
) -> InlineKeyboardMarkup:
return InlineKeyboardBuilder(get_search_variants(query, services)).as_markup()