Fixing Dangercord check to ensure it does not continue verification

This commit is contained in:
ExtrasContainer
2024-02-04 22:27:01 +00:00
parent cd8749c2da
commit fb9ad1b181
+16 -9
View File
@@ -105,6 +105,7 @@ module.exports = {
}
let attempts = 0;
let blacklisted = false;
const maxAttempts = cfg.maxAttempts;
let validated = false; // Flag to track if user is already validated
@@ -119,30 +120,36 @@ module.exports = {
return;
}
if (attempts == 1 ){
if (attempts == 1) {
// Check the Dangercord API using our custom library function
dangercordcheckVerification(interaction.user.id)
await dangercordcheckVerification(interaction.user.id)
.then(result => {
console.log('Verification result:', result);
if (result == 1) {
if (result === 1) {
console.log(`${interaction.user.id} is not blacklisted at dangercord, lets continue with the verification process`)
// Proceed with further actions
} else {
(async () => {
await interaction.reply({
console.log(`${interaction.user.id} is blacklisted at dangercord, we will not continue with the verification process`);
blacklisted = true; // Set blacklisted to true
// Handle the case when user is blacklisted
interaction.editReply({
content: cfg.messages.cannotContinue,
ephemeral: true
});
})();
console.log(`${interaction.user.id} is blacklisted at dangercord, we will not continue with the verification process`)
}).then(() => {
// Stop execution here
return;
}).catch(error => {
console.error('Error:', error);
});
}
})
.catch(error => {
console.error('Error:', error);
});
}
if (blacklisted == true) return
const buff = await createCaptcha(captcha);
const attachment = new AttachmentBuilder(buff, { name: 'captcha.png' });