Bro it's showing 68 errors but everything works properly :(((((((
This commit is contained in:
@@ -11,11 +11,23 @@ module.exports = {
|
||||
const guildId = interaction.guild.id;
|
||||
//functions here
|
||||
async function generateCaptcha(count) {
|
||||
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
var captcha = '';
|
||||
var upchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
var lowchars = "abcdefghijklmnopqrstuvwxyz";
|
||||
var nums = "0123456789";
|
||||
//get a random letter/number from upchars, lowchars, and nums
|
||||
var chars = upchars + lowchars + nums;
|
||||
var captcha = "";
|
||||
for (var i = 0; i < count; i++) {
|
||||
captcha += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||
var c = Math.floor(Math.random() * 3);
|
||||
if (c === 0) {
|
||||
captcha += upchars.charAt(Math.floor(Math.random() * upchars.length));
|
||||
} else if (c === 1) {
|
||||
captcha += lowchars.charAt(Math.floor(Math.random() * lowchars.length));
|
||||
} else {
|
||||
captcha += nums.charAt(Math.floor(Math.random() * nums.length));
|
||||
}
|
||||
}
|
||||
|
||||
return captcha;
|
||||
}
|
||||
|
||||
@@ -70,10 +82,16 @@ module.exports = {
|
||||
|
||||
collector.on('collect', async (m) => {
|
||||
if (m.content === captcha) {
|
||||
//if member left the server before the verification is done
|
||||
if (!interaction.guild.members.cache.has(interaction.user.id)) {
|
||||
await interaction.user.send(cfg.messages.userLeft);
|
||||
collector.stop();
|
||||
} else {
|
||||
await interaction.member.roles.add(cfg.guilds[guildId].roleToAdd);
|
||||
await interaction.member.roles.remove(cfg.guilds[guildId].firstRole);
|
||||
await interaction.user.send(cfg.messages.success);
|
||||
collector.stop();
|
||||
}
|
||||
} else {
|
||||
await interaction.user.send(cfg.messages.fail);
|
||||
collector.stop();
|
||||
@@ -85,17 +103,17 @@ module.exports = {
|
||||
await interaction.user.send(cfg.messages.tookTooLong);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(async (err) => {
|
||||
}
|
||||
).catch(async (err) => {
|
||||
await interaction.reply({
|
||||
content: cfg.messages.unableToDM,
|
||||
ephemeral: true
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Note from Naoki:
|
||||
This looks simple enough but damn.
|
||||
|
||||
Reference in New Issue
Block a user