18 lines
493 B
Python
18 lines
493 B
Python
from .Logger import logger
|
|
from asyncio import sleep
|
|
from disnake import FFmpegPCMAudio
|
|
|
|
|
|
async def play_audio(audio, bot, vc):
|
|
if not bot.voice_clients:
|
|
logger.info(audio)
|
|
logger.error(f'Playing: {audio}')
|
|
await sleep(1)
|
|
vp = await vc.connect()
|
|
if not vp.is_playing():
|
|
vp.play(FFmpegPCMAudio(f'audio/{audio}'), after=None)
|
|
while vp.is_playing():
|
|
await sleep(0.5)
|
|
await sleep(1)
|
|
await vp.disconnect()
|