1
0
Fork 0
mirror of https://gitlab.jonasled.de/jonasled/discordbot synced 2024-10-03 07:48:58 +02:00

fixed delete on !stop

This commit is contained in:
Jonas Leder 2020-04-10 21:24:03 +02:00
parent ba5ce20e10
commit 22b270f9d4

7
bot.py
View file

@ -9,6 +9,7 @@ from config import *
from requests import get
from json import loads
from os.path import isfile
from os import listdir
from os import rename, remove
from youtube_dl import YoutubeDL
from time import time
@ -439,7 +440,7 @@ async def stop(ctx):
global titleQue
global downloadQue
global playerServer
if (playerServer != ctx.message.guild.id):#check if the music bot runns on this server
await ctx.message.channel.send("You can't stop the music bot on a different server.")
return
@ -472,7 +473,9 @@ async def checkForNextSong():#background task, that runns every seccond and chec
await player.disconnect()
player = None
playerServer = None#allow everyone to invite the music bot
remove("*.mp3")#delete all mp3 files
for files in listdir("."):#delete all mp3 files
if files.endswith(".mp3"):
remove(files)
else:
playing = True#set playing to true and play the next file
player.play(discord.FFmpegPCMAudio(playerQue[0]))