diff --git a/lava/cogs/commands.py b/lava/cogs/commands.py index 208be1c2..a9a902e8 100644 --- a/lava/cogs/commands.py +++ b/lava/cogs/commands.py @@ -145,10 +145,17 @@ async def nowplaying(self, interaction: ApplicationCommandInteraction): description=Localized("要將歌曲放置於當前播放序列的位置", key="command.play.option.index"), type=OptionType.integer, required=False + ), + Option( + name="shuffle", + description=Localized("是否開啟隨機播放模式", key="command.play.option.shuffle"), + type=OptionType.boolean, + required=False ) ] ) - async def play(self, interaction: ApplicationCommandInteraction, query: str, index: int = None): + async def play(self, interaction: ApplicationCommandInteraction, query: str, + index: int = None, shuffle: bool = False): await interaction.response.defer() await ensure_voice(interaction, should_connect=True) @@ -242,6 +249,8 @@ async def play(self, interaction: ApplicationCommandInteraction, query: str, ind if not player.is_playing: await player.play() + player.set_shuffle(shuffle=shuffle) + await player.update_display(await interaction.original_response(), delay=5, locale=interaction.locale) @commands.slash_command( diff --git a/locale/zh_TW.json b/locale/zh_TW.json index ea987722..2b5ff5cf 100644 --- a/locale/zh_TW.json +++ b/locale/zh_TW.json @@ -19,6 +19,7 @@ "command.play.description": "播放音樂", "command.play.option.query": "歌曲名稱或網址,支援 YouTube, YouTube Music, SoundCloud, Spotify", "command.play.option.index": "要將歌曲放置於當前播放序列的位置", + "command.play.option.shuffle": "是否開啟隨機播放模式", "command.play.error.no_results.title": "沒有找到任何歌曲", "command.play.error.no_results.description": "如果你想要使用關鍵字搜尋,請在輸入關鍵字後等待幾秒,搜尋結果將會自動顯示在上方", "command.play.filter_warning.title": "提醒",