I would like to know if there is a way to get the guild id with the userUpdate event i need this for mongodb LogsSchema.findOne({ guildId: the id of the guild})
client.on('userUpdate', (oldUser, newUser) => {
const LogsSchema = require('./structures/LogsChannel')
LogsSchema.findOne({ guildId: message.guild.id}, async (err, logsdata) => {
if (!logsdata) return;
const channel = logsdata.logschannelId
if (oldUser.discriminator !== newUser.discriminator) client.channels.cache.get(channel).send({ embeds: [
client.functions.embed()
.setTitle(`> 【 PROFIL 】`)
.setThumbnail(newUser.displayAvatarURL())
.setDescription(` <@${newUser.id}> a changé son tag !`)
.addFields(
{ name: 'Ancien tag:', value: `\`#${oldUser.discriminator}\``, inline: true},
{ name: 'Nouveau tag:', value: `\`#${newUser.discriminator}\``, inline: true},
)
.setTimestamp()
.setFooter(`ID ${newUser.id}`)
]})
})