#captcha
1 messages · Page 1 of 1 (latest)
@versed trench
It is not very complicated
So
The main idea is to verify users after passing the captcha code
so you just give the user a role when they complete the captcha?
When a user logs on to the server, a picture with a code is sent to the chat
Bot removes particular role
const code = your code
const userCode = code user sent
if (code === userCode) {
// Your stuff
} else {
// Your other stuff
}
Then the user writes /captcha code
If the code is correct, authorization occurs, otherwise a new picture is sent
What’s your question? How to get the code that the user inputted?
How to use interactions properly
The first message is not an interaction
Check now
Wait
client.on("interactionCreate", async interaction => {
if(interaction.isCommand() && interaction.commandName == "captcha") {
const code = interaction.options.getString("code")
const author = interaction.user
if(code == null) {
let [text, image] = await captcha();
interaction.reply({
content: "Use /captcha [code]",
files: [
new Discord.MessageAttachment(image, "captcha.png")
],
ephemeral: true
})
captches[author.id] = text
} else {
if(captches[author.id] != code) {
interaction.reply({
content: "Captcha is wrong. Use /captcha",
ephemeral: true
})
if(captches[author.id] != undefined)
delete captches[author.id];
} else {
return interaction.reply({
content: "Authorized",
ephemeral: true
})
}
}
}
});
This one
I've read it several times
When the user logs in, a normal message is sent. Every next one will be an interaction
Have you ever done a captcha?
ok
Do you have a question relating to discordjs? @lean minnow
Just like OTP verifying
Yep
How to use interactions correclty
Wait, wdym?
?
I’ve already sent you a link to the guide
It's not clear
so what you're trying to do is to send a msg in a channel when guildMemberAdd and the user uses an interaction to fill up the captcha you just sent in the guildMemberAdd event?
Yes
This code return interaction error, when i use /captcha
Whats the error
Native discord error
can you show us the original error?
To sum up
When logging in, a message with a picture is sent to the user - the usual one, visible to all users
using /captcha [code], the user enters the code from the image. From this moment the interaction begins
If the code is correct, the bot authorizes the user
If the code is incorrect, the bot sends a new code
@versed trench can u help?
use api?