Relance music si crash/reboot + Réécriture /amp

This commit is contained in:
Zachary Guénot
2023-05-28 20:39:11 +02:00
parent f6bf2f8616
commit d02dd5bace
15 changed files with 234 additions and 108 deletions

View File

@@ -70,6 +70,12 @@ module.exports = {
await entry.getTask()
queue.addTrack(track)
// Write the values in the .env file to recover the player if the bot restarts
writeEnv('DISCORD_MUSIC_TEXTCHANNEL_ID', interaction.channel.id)
writeEnv('DISCORD_MUSIC_VOICECHANNEL_ID', voiceChannel.id)
writeEnv('DISCORD_MUSIC_CURRENT_TRACK', track.url)
writeEnv('DISCORD_MUSIC_CURRENT_PROGRESS', 0)
try {
if (!queue.isPlaying()) await queue.node.play()
track.source = track.source === 'youtube' ? 'Youtube' : track.source === 'spotify' ? 'Spotify' : 'Inconnu'