used black
This commit is contained in:
@@ -1,27 +1,23 @@
|
||||
from aiogram.utils.keyboard import (InlineKeyboardMarkup, InlineKeyboardButton,
|
||||
InlineKeyboardBuilder)
|
||||
from aiogram.utils.keyboard import (
|
||||
InlineKeyboardMarkup,
|
||||
InlineKeyboardButton,
|
||||
InlineKeyboardBuilder,
|
||||
)
|
||||
from bot.factories.full_menu import FullMenuCallback
|
||||
|
||||
from bot.keyboards.inline import search_variants as sv
|
||||
|
||||
|
||||
def get_full_menu_kb() -> InlineKeyboardMarkup:
|
||||
buttons = (sv.get_search_variants(
|
||||
query='',
|
||||
services=
|
||||
sv.soundcloud |
|
||||
sv.spotify |
|
||||
sv.deezer |
|
||||
sv.youtube
|
||||
buttons = sv.get_search_variants(
|
||||
query="", services=sv.soundcloud | sv.spotify | sv.deezer | sv.youtube
|
||||
) + [
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text='⚙️ Settings',
|
||||
callback_data=FullMenuCallback(
|
||||
action='settings'
|
||||
).pack()
|
||||
)
|
||||
],
|
||||
])
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="⚙️ Settings",
|
||||
callback_data=FullMenuCallback(action="settings").pack(),
|
||||
)
|
||||
],
|
||||
]
|
||||
|
||||
return InlineKeyboardBuilder(buttons).as_markup()
|
||||
|
||||
@@ -1,42 +1,34 @@
|
||||
from aiogram.utils.keyboard import (InlineKeyboardMarkup, InlineKeyboardButton,
|
||||
InlineKeyboardBuilder)
|
||||
from aiogram.utils.keyboard import (
|
||||
InlineKeyboardMarkup,
|
||||
InlineKeyboardButton,
|
||||
InlineKeyboardBuilder,
|
||||
)
|
||||
|
||||
|
||||
deezer = {
|
||||
'd': '🎵 Search in Deezer'
|
||||
}
|
||||
soundcloud = {
|
||||
'c': '☁️ Search in SoundCloud'
|
||||
}
|
||||
youtube = {
|
||||
'y': '▶️ Search in YouTube'
|
||||
}
|
||||
spotify = {
|
||||
's': '🎧 Search in Spotify'
|
||||
}
|
||||
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],
|
||||
query: str,
|
||||
services: dict[str, str],
|
||||
) -> list[list[InlineKeyboardButton]]:
|
||||
buttons = [
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text=services[key],
|
||||
switch_inline_query_current_chat=f'{key}:{query}'
|
||||
text=services[key], switch_inline_query_current_chat=f"{key}:{query}"
|
||||
)
|
||||
] for key in services.keys()
|
||||
]
|
||||
for key in services.keys()
|
||||
]
|
||||
|
||||
return buttons
|
||||
|
||||
|
||||
def get_search_variants_kb(
|
||||
query: str,
|
||||
services: dict[str, str],
|
||||
query: str,
|
||||
services: dict[str, str],
|
||||
) -> InlineKeyboardMarkup:
|
||||
return InlineKeyboardBuilder(get_search_variants(
|
||||
query,
|
||||
services
|
||||
)).as_markup()
|
||||
return InlineKeyboardBuilder(get_search_variants(query, services)).as_markup()
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
from aiogram.utils.keyboard import (InlineKeyboardMarkup, InlineKeyboardButton,
|
||||
InlineKeyboardBuilder)
|
||||
from aiogram.utils.keyboard import (
|
||||
InlineKeyboardMarkup,
|
||||
InlineKeyboardButton,
|
||||
InlineKeyboardBuilder,
|
||||
)
|
||||
from bot.factories.open_setting import SettingChoiceCallback
|
||||
from bot.factories.full_menu import FullMenuCallback
|
||||
|
||||
@@ -11,22 +14,21 @@ def get_setting_kb(s_id: str, user_id: str) -> InlineKeyboardMarkup:
|
||||
buttons = [
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text=(
|
||||
'✅ ' if setting.value == choice else ''
|
||||
) + setting.choices[choice],
|
||||
text=("✅ " if setting.value == choice else "")
|
||||
+ setting.choices[choice],
|
||||
callback_data=SettingChoiceCallback(
|
||||
s_id=s_id,
|
||||
choice=choice,
|
||||
).pack()
|
||||
).pack(),
|
||||
)
|
||||
] for choice in setting.choices.keys()
|
||||
] + [[
|
||||
InlineKeyboardButton(
|
||||
text='🔙',
|
||||
callback_data=FullMenuCallback(
|
||||
action='settings'
|
||||
).pack()
|
||||
)
|
||||
]]
|
||||
]
|
||||
for choice in setting.choices.keys()
|
||||
] + [
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="🔙", callback_data=FullMenuCallback(action="settings").pack()
|
||||
)
|
||||
]
|
||||
]
|
||||
|
||||
return InlineKeyboardBuilder(buttons).as_markup()
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
from aiogram.utils.keyboard import (InlineKeyboardMarkup, InlineKeyboardButton,
|
||||
InlineKeyboardBuilder)
|
||||
from aiogram.utils.keyboard import (
|
||||
InlineKeyboardMarkup,
|
||||
InlineKeyboardButton,
|
||||
InlineKeyboardBuilder,
|
||||
)
|
||||
from bot.factories.open_setting import OpenSettingCallback
|
||||
from bot.factories.full_menu import FullMenuCallback
|
||||
|
||||
@@ -13,16 +16,16 @@ def get_settings_kb() -> InlineKeyboardMarkup:
|
||||
text=settings_strings[setting_id].name,
|
||||
callback_data=OpenSettingCallback(
|
||||
s_id=setting_id,
|
||||
).pack()
|
||||
).pack(),
|
||||
)
|
||||
] for setting_id in settings_strings.keys()
|
||||
] + [[
|
||||
InlineKeyboardButton(
|
||||
text='🔙',
|
||||
callback_data=FullMenuCallback(
|
||||
action='home'
|
||||
).pack()
|
||||
)
|
||||
]]
|
||||
]
|
||||
for setting_id in settings_strings.keys()
|
||||
] + [
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="🔙", callback_data=FullMenuCallback(action="home").pack()
|
||||
)
|
||||
]
|
||||
]
|
||||
|
||||
return InlineKeyboardBuilder(buttons).as_markup()
|
||||
|
||||
Reference in New Issue
Block a user