I am developing a music bot for Discord using discord.py, and I want it to automatically exit the voice channel if it remains inactive for a specific duration, such as 5 minutes. In this context, inactivity refers to the bot not playing any tracks. The command utilized to initiate the playback is:
voice.start_playing(discord.FFmpegPCMAudio(track))
And I use:
voice.halt()
to stop the playback.
The voice object in use is discord.VoiceClient.