Skip to content

Commit

Permalink
Merge pull request #95 from Nat1anWasTaken/91-feat-lofi-command
Browse files Browse the repository at this point in the history
feat: add new slash command 'lofi' to play Lofi Radio
  • Loading branch information
Nat1anWasTaken authored Jun 6, 2024
2 parents 40228c6 + cabaa2e commit 34d5417
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lava/cogs/commands.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions locale/zh_TW.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"command.lofi.name": "lofi",
"command.lofi.description": "播放 Lofi Radio",
"command.info.name": "info",
"command.info.description": "顯示機器人的資訊",
"command.info.embed.title": "機器人資訊",
Expand Down

0 comments on commit 34d5417

Please sign in to comment.