Relance music si crash/reboot + Réécriture /amp
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
const { SlashCommandBuilder } = require('discord.js')
|
||||
const generatePlayer = require('../../utilsPlayer/generate.js')
|
||||
|
||||
const appDir = require('path').dirname(require.main.filename)
|
||||
const generatePlayer = require(appDir + '/utilsPlayer/generate.js')
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
|
||||
@@ -8,6 +8,12 @@ module.exports = {
|
||||
async execute(interaction) {
|
||||
let queue = useQueue(interaction.guild.id)
|
||||
queue.delete()
|
||||
|
||||
writeEnv('DISCORD_MUSIC_TEXTCHANNEL_ID', '')
|
||||
writeEnv('DISCORD_MUSIC_VOICECHANNEL_ID', '')
|
||||
writeEnv('DISCORD_MUSIC_CURRENT_TRACK', '')
|
||||
writeEnv('DISCORD_MUSIC_CURRENT_PROGRESS', '')
|
||||
|
||||
return await interaction.reply('Musique arrêtée !')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user