mirror of
https://github.com/deadcxap/YandexMusicDiscordBot.git
synced 2026-01-13 21:51:54 +03:00
feat: Add /account likes and user playlists search.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from discord.ui import View, Button, Item
|
||||
from discord import ButtonStyle, Interaction, ApplicationContext
|
||||
|
||||
from MusicBot.cogs.utils.voice import VoiceExtension
|
||||
from MusicBot.cogs.utils.voice_extension import VoiceExtension
|
||||
|
||||
class ToggleRepeatButton(Button, VoiceExtension):
|
||||
def __init__(self, **kwargs):
|
||||
@@ -77,6 +77,24 @@ class PrevTrackButton(Button, VoiceExtension):
|
||||
if not title:
|
||||
await interaction.respond(f"Нет треков в истории.", delete_after=15, ephemeral=True)
|
||||
|
||||
class LikeButton(Button, VoiceExtension):
|
||||
def __init__(self, **kwargs):
|
||||
Button.__init__(self, **kwargs)
|
||||
VoiceExtension.__init__(self)
|
||||
|
||||
async def callback(self, interaction: Interaction) -> None:
|
||||
if await self.voice_check(interaction):
|
||||
vc = self.get_voice_client(interaction)
|
||||
if not vc or not vc.is_playing:
|
||||
await interaction.respond("Нет воспроизводимого трека.", delete_after=15, ephemeral=True)
|
||||
result = await self.like_track(interaction)
|
||||
if not result:
|
||||
await interaction.respond("❌ Операция не удалась.", delete_after=15, ephemeral=True)
|
||||
elif result == 'TRACK REMOVED':
|
||||
await interaction.respond("Трек был удалён из избранного.", delete_after=15, ephemeral=True)
|
||||
else:
|
||||
await interaction.respond(f"Трек **{result}** был добавлен в избранное.", delete_after=15, ephemeral=True)
|
||||
|
||||
class Player(View, VoiceExtension):
|
||||
|
||||
def __init__(self, ctx: ApplicationContext | Interaction, *items: Item, timeout: float | None = 3600, disable_on_timeout: bool = True):
|
||||
|
||||
Reference in New Issue
Block a user