Fixing Dangercord check to ensure it does not continue verification
This commit is contained in:
@@ -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 ){
|
||||
// Check the Dangercord API using our custom library function
|
||||
dangercordcheckVerification(interaction.user.id)
|
||||
.then(result => {
|
||||
console.log('Verification result:', result);
|
||||
if (result == 1) {
|
||||
console.log(`${interaction.user.id} is not blacklisted at dangercord, lets continue with the verification process`)
|
||||
} else {
|
||||
(async () => {
|
||||
await interaction.reply({
|
||||
if (attempts == 1) {
|
||||
// Check the Dangercord API using our custom library function
|
||||
await dangercordcheckVerification(interaction.user.id)
|
||||
.then(result => {
|
||||
console.log('Verification result:', result);
|
||||
if (result === 1) {
|
||||
console.log(`${interaction.user.id} is not blacklisted at dangercord, lets continue with the verification process`)
|
||||
// Proceed with further actions
|
||||
} else {
|
||||
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
|
||||
}).then(() => {
|
||||
// Stop execution here
|
||||
return;
|
||||
}).catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
})();
|
||||
console.log(`${interaction.user.id} is blacklisted at dangercord, we will not continue with the verification process`)
|
||||
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' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user