restore
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -9,4 +9,6 @@
|
|||||||
/venv/
|
/venv/
|
||||||
/fun_and_admin_bot.egg-info/
|
/fun_and_admin_bot.egg-info/
|
||||||
/.YMcache/
|
/.YMcache/
|
||||||
config.json
|
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:
|
if inter.author.voice is not None:
|
||||||
await inter.response.send_message(f'Played {audio}', ephemeral=True)
|
await inter.response.send_message(f'Played {audio}', ephemeral=True)
|
||||||
|
|
||||||
await play_audio(audio, self.bot, inter.author.voice.channel)
|
await play_audio(audio, self.bot, inter.author.voice.channel)
|
||||||
else:
|
else:
|
||||||
await inter.response.send_message('You`re not in voice', ephemeral=True)
|
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')
|
@playaudio.autocomplete('audio')
|
||||||
async def list_to_play(self, inter: disnake.ApplicationCommandInteraction, current: str):
|
async def list_to_play(self, inter: disnake.ApplicationCommandInteraction, current: str):
|
||||||
current = current.lower()
|
current = current.lower()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ async def play_audio(audio, bot, vc):
|
|||||||
logger.error(f'Playing: {audio}')
|
logger.error(f'Playing: {audio}')
|
||||||
vp = await vc.connect()
|
vp = await vc.connect()
|
||||||
if not vp.is_playing():
|
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():
|
while vp.is_playing():
|
||||||
await sleep(0.5)
|
await sleep(0.5)
|
||||||
await sleep(1)
|
await sleep(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user