diff --git a/lava/cogs/commands.py b/lava/cogs/commands.py index 3c439525..59c80468 100644 --- a/lava/cogs/commands.py +++ b/lava/cogs/commands.py @@ -1,6 +1,4 @@ import re -from os import getpid - from disnake import Option, ApplicationCommandInteraction, OptionType, OptionChoice, ButtonStyle, Localized, Embed from disnake.ext import commands from disnake.ext.commands import Cog @@ -30,6 +28,15 @@ class Commands(Cog): def __init__(self, bot: Bot): self.bot = bot + @commands.slash_command( + name=Localized("lofi", key="command.lofi.name"), + description=Localized("播放 Lofi Radio", key="command.lofi.description") + ) + async def lofi(self, interaction: ApplicationCommandInteraction): + result = await self.bot.lavalink.get_tracks(f"ytsearch:{query}") + + await self.play(interaction, query=result.tracks[0].uri) + @commands.slash_command( name=Localized("info", key="command.info.name"), description=Localized("顯示機器人資訊", key="command.info.description") diff --git a/locale/zh_TW.json b/locale/zh_TW.json index aeb14896..c315fe51 100644 --- a/locale/zh_TW.json +++ b/locale/zh_TW.json @@ -1,4 +1,6 @@ { + "command.lofi.name": "lofi", + "command.lofi.description": "播放 Lofi Radio", "command.info.name": "info", "command.info.description": "顯示機器人的資訊", "command.info.embed.title": "機器人資訊",