restore
This commit is contained in:
@@ -55,10 +55,31 @@ class Audio(commands.Cog, name='Audio'):
|
||||
):
|
||||
if inter.author.voice is not None:
|
||||
await inter.response.send_message(f'Played {audio}', ephemeral=True)
|
||||
|
||||
await play_audio(audio, self.bot, inter.author.voice.channel)
|
||||
else:
|
||||
await inter.response.send_message('You`re not in voice', ephemeral=True)
|
||||
|
||||
@commands.slash_command(name="play_random",
|
||||
description="Make possible playing audio by command",
|
||||
options=[
|
||||
Option(name="num",
|
||||
type=OptionType.integer,
|
||||
)
|
||||
])
|
||||
async def playrandom(self, inter: disnake.ApplicationCommandInteraction,
|
||||
num: int
|
||||
):
|
||||
if inter.author.voice is not None:
|
||||
audio: list = []
|
||||
for _a in ListGenerator('audio'):
|
||||
audio.append(_a.name)
|
||||
for i in range(num):
|
||||
logger.info(f'Played {i+1} times')
|
||||
await play_audio(f'audio/{random.choice(audio)}', self.bot, inter.author.voice.channel)
|
||||
else:
|
||||
await inter.response.send_message('You`re not in voice', ephemeral=True)
|
||||
|
||||
@playaudio.autocomplete('audio')
|
||||
async def list_to_play(self, inter: disnake.ApplicationCommandInteraction, current: str):
|
||||
current = current.lower()
|
||||
|
||||
Reference in New Issue
Block a user