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

View File

@@ -0,0 +1,19 @@
import { Events, Guild } from 'discord.js'
import dbGuildInit from '../../utils/dbGuildInit'
import dbGuild from '../../schemas/guild'
export default {
name: Events.GuildUpdate,
async execute(oldGuild: Guild, newGuild: Guild) {
console.log(`Guild ${oldGuild.name} updated`)
let guildProfile = await dbGuild.findOne({ guildId: newGuild.id })
if (!guildProfile) {
guildProfile = await dbGuildInit(newGuild)
} else {
guildProfile.guildName = newGuild.name
guildProfile.guildIcon = newGuild.iconURL() ?? 'None'
await guildProfile.save().catch(console.error)
}
}
}