add logs for admin channel to notify when user verified successfully

This commit is contained in:
Ayden Jahola 2024-09-02 21:31:20 +01:00
parent 8a73c3860c
commit 6d6d9b8a58
No known key found for this signature in database
GPG key ID: 71DD90AE4AE92742

View file

@ -76,10 +76,22 @@ module.exports = {
} }
await member.roles.add(role); await member.roles.add(role);
await VerificationCode.deleteOne({ userId: interaction.user.id, code }); await VerificationCode.deleteOne({ userId: interaction.user.id, code });
// the verification code is no longer needed, but it will automatically be deleted after 10 minutes no need to manually delete it // Get the admin log channel
const adminLogChannel = client.channels.cache.get(
process.env.ADMIN_LOG_CHANNEL_ID
);
if (adminLogChannel) {
// Send the log message
await adminLogChannel.send({
content: `🎉 **Verification Success**\nUser: <@${interaction.user.id}> (${interaction.user.tag})\nRole: ${role.name}`,
});
} else {
console.error("Admin log channel not found.");
}
return interaction.reply({ return interaction.reply({
content: `Congratulations ${interaction.user.username}, you have been verified!`, content: `Congratulations ${interaction.user.username}, you have been verified!`,
ephemeral: true, ephemeral: true,