Intégration MongoDB + Fix export et amp

This commit is contained in:
Angels-dev
2024-02-29 00:24:21 +01:00
parent 397a45e371
commit 94c7fc1c98
63 changed files with 1608 additions and 1161 deletions

24
src/events/player/disconnect.ts Executable file
View File

@@ -0,0 +1,24 @@
import { GuildQueue, Track } from 'discord-player'
import { PlayerMetadata } from '../../utilsPlayer/metadata'
import dbGuild from '../../schemas/guild'
export default {
name: 'disconnect',
async execute(queue: GuildQueue<PlayerMetadata>, track: Track) {
// Emitted when the bot leaves the voice channel
queue.metadata.channel.send("J'ai quitté le vocal !")
let guildProfile = await dbGuild.findOne({ guildId: queue.guild.id })
if (!guildProfile) return console.log(`Database data for **${queue.guild.name}** does not exist !`)
let dbData = guildProfile.get('guildPlayer.replay')
dbData['textChannelId'] = ''
dbData['voiceChannelId'] = ''
dbData['trackUrl'] = ''
dbData['progress'] = ''
guildProfile.set('guildPlayer.replay', dbData)
guildProfile.markModified('guildPlayer.replay')
return await guildProfile.save().catch(console.error)
}
}