correction command play

This commit is contained in:
BFlow 2020-04-29 18:47:58 +02:00
parent 5ed705a41c
commit 7fd4d9dc5f

View file

@ -44,11 +44,13 @@ class Mybot(commands.Cog):
self.sounds_history.reverse() self.sounds_history.reverse()
if len(self.sounds_history) > 5: if len(self.sounds_history) > 5:
self.sounds_history = self.sounds_history[:5] self.sounds_history = self.sounds_history[:5]
if audio_file.startswith('/tmp'):
os.remove(audio_file)
#Fin des fonctions necesaire pour Kabot. #Fin des fonctions necesaire pour Kabot.
#Les commandes pour interagir avec Kabot. #Les commandes pour interagir avec Kabot.
@commands.command(help='Clear sound queue')
async def clear(self, ctx):
self.sounds = []
@commands.command() @commands.command()
async def disconnect(self, ctx): async def disconnect(self, ctx):
await ctx.guild.voice_client.disconnect() await ctx.guild.voice_client.disconnect()
@ -108,10 +110,6 @@ class Mybot(commands.Cog):
async def restart(self, ctx): async def restart(self, ctx):
await self.bot.logout() await self.bot.logout()
@commands.command(help='Clear sound queue')
async def clear(self, ctx):
self.sounds = []
@commands.command(help='Update local repo') @commands.command(help='Update local repo')
async def update(self, message): async def update(self, message):
output = Popen('git pull'.split(), stdout=PIPE).communicate()[0] output = Popen('git pull'.split(), stdout=PIPE).communicate()[0]
@ -272,7 +270,7 @@ class Mybot(commands.Cog):
with youtube_dl.YoutubeDL(ydl_opts) as ydl: with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url]) ydl.download([url])
info_dict = ydl.extract_info(url, download=False) info_dict = ydl.extract_info(url, download=False)
out_file = ydl.prepare_filename(info_dict) out_file = ydl.prepare_filename(info_dict).replace(".webm", ".mp3")
self.sounds.append((out_file, ctx)) self.sounds.append((out_file, ctx))
@commands.command() @commands.command()