Skip to content
Advertisement

How to delete mp3 file after the bot played it

I am trying to create a music bot and now I want the bot to delete the current playing song after it finished playing. There’s my code:

JavaScript

It’s saving the files to a folder called “music_files” with the format videoid.mp3 I noticed that it’s logging something in the cmd when logging.basicConfig(level=logging.INFO) is added to the main.py file under the imports, is there maybe a way to use it?

Note: The code is a modified version of basic_voice.py by Rapptz.

Edit: I found a way:

JavaScript

Advertisement

Answer

You can remove the file with os.remove(f'PATH/{videoid}.mp3')

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement