restore
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -10,3 +10,5 @@
|
||||
/fun_and_admin_bot.egg-info/
|
||||
/.YMcache/
|
||||
config.json
|
||||
/env/
|
||||
/.project
|
||||
|
||||
10
check.py
Executable file
10
check.py
Executable file
@@ -0,0 +1,10 @@
|
||||
for i in range(133):
|
||||
|
||||
if i in [11, 12, 13, 14]:
|
||||
print(f'{i} дней')
|
||||
elif i % 10 == 1:
|
||||
print(f'{i} день')
|
||||
elif i % 10 in [2, 3, 4]:
|
||||
print(f'{i} дня')
|
||||
else:
|
||||
print(f'{i} дней')
|
||||
@@ -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()
|
||||
|
||||
@@ -13,7 +13,7 @@ async def play_audio(audio, bot, vc):
|
||||
logger.error(f'Playing: {audio}')
|
||||
vp = await vc.connect()
|
||||
if not vp.is_playing():
|
||||
vp.play(FFmpegOpusAudio(f'{audio}', ))
|
||||
vp.play(FFmpegOpusAudio(f'{audio}', executable='ffmpeg', options='-nostats -loglevel 0'))
|
||||
while vp.is_playing():
|
||||
await sleep(0.5)
|
||||
await sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user