Did a little mischievous stuff.
This commit is contained in:
@@ -24,6 +24,6 @@ module.exports = {
|
||||
'alreadyVerified': 'You are already verified.',
|
||||
'tookTooLong': 'You took too long to respond. Please try again.',
|
||||
'unableToDM': 'I was unable to send you a DM. Please make sure "Allow Direct Message" for this guild is enabled.',
|
||||
'maxAttemptsExceeded': 'You have run out of attempts!'
|
||||
'maxAttemptsExceeded': 'Verification failed. You have run out of attempts!'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { EmbedBuilder, ApplicationCommandType, Collection, AttachmentBuilder } = require('discord.js');
|
||||
const { createCanvas, loadImage } = require('canvas');
|
||||
const cfg = require('../../config/config.js');
|
||||
const captchaUser = new Collection();
|
||||
|
||||
module.exports = {
|
||||
name: 'verify',
|
||||
description: 'To verify yourself.',
|
||||
@@ -14,8 +14,6 @@ module.exports = {
|
||||
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++) {
|
||||
@@ -45,12 +43,14 @@ module.exports = {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
if (interaction.channel.id !== cfg.guilds[guildId].channelId) {
|
||||
return interaction.reply({ content: cfg.messages.wrongChannel, ephemeral: true })
|
||||
return interaction.editReply({ content: cfg.messages.wrongChannel, ephemeral: true })
|
||||
}
|
||||
|
||||
if (interaction.member.roles.cache.has(cfg.guilds[guildId].roleToAdd)) {
|
||||
return interaction.reply({ content: cfg.messages.alreadyVerified, ephemeral: true })
|
||||
return interaction.editReply({ content: cfg.messages.alreadyVerified, ephemeral: true })
|
||||
}
|
||||
|
||||
let attempts = 0;
|
||||
@@ -73,13 +73,11 @@ module.exports = {
|
||||
.setColor('Green')
|
||||
.setImage('attachment://captcha.png')
|
||||
.setTimestamp();
|
||||
if (attempts > 1) {
|
||||
await interaction.user.send(cfg.messages.fail);
|
||||
}
|
||||
|
||||
await interaction.user.send({
|
||||
embeds: [embed], files: [attachment]
|
||||
}).then(async (msg) => {
|
||||
await interaction.editReply({ content: cfg.messages.toVerify, ephemeral: true });
|
||||
const filter = m => !m.author.bot && m.author.id === interaction.user.id && m.channel.id === msg.channel.id;
|
||||
const collector = msg.channel.createMessageCollector({
|
||||
filter,
|
||||
@@ -92,7 +90,6 @@ module.exports = {
|
||||
await interaction.user.send(cfg.messages.userLeft);
|
||||
collector.stop();
|
||||
} else {
|
||||
|
||||
if (m.content === captcha) {
|
||||
validated = true;
|
||||
await interaction.member.roles.add(cfg.guilds[guildId].roleToAdd);
|
||||
@@ -117,7 +114,7 @@ module.exports = {
|
||||
|
||||
});
|
||||
}).catch(async (err) => {
|
||||
await interaction.reply({
|
||||
await interaction.editReply({
|
||||
content: cfg.messages.unableToDM,
|
||||
ephemeral: true
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user