Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bot.on("message", async function(message) {
- if (message.content == prefix + "genCaptcha") {
- var { text, image } = await createCaptcha();
- message.channel.send(
- text,
- new discord.MessageAttachment(image, "captcha.png")
- );
- }
- });
- const randomPuppy = require("random-puppy");
- const createCaptcha = require("./captcha.js");
- bot.on("ready", () => {
- console.log(`${bot.user.tag} has logged in.`);
- });
- bot.on("guildMemberAdd", async member => {
- var captcha = await createCaptcha();
- try {
- var attachment = new discord.MessageAttachment(
- captcha.image,
- "captcha.png"
- );
- await bot.channels
- .fetch("l'id de votre bot")
- .then(function(ch) {
- ch.send(
- "Hello, <@" +
- member.id +
- ">. In order to access this server, you need to solve a quick captcha. You have 5 minutes to do it before you're kicked. ",
- attachment
- );
- })
- .catch(function(Err) {
- console.error(Err);
- });
- try {
- const filter = m => {
- if (m.author.bot) return;
- if (m.author.id === member.id && m.content === captcha.text)
- return true;
- else {
- m.channel.send("You entered the captcha incorrectly.");
- return false;
- }
- };
- const response = await bot.channels
- .fetch("l'id de votre salon")
- .then(async function(chan) {
- response = chan
- .awaitMessages(filter, { max: 1, time: 300000, errors: ["time"] })
- .then(async function(response) {
- if (response) {
- await member.send("You have verified yourself!");
- await member.roles.add("l'id du rôle qie vous voulez mettre à la personne");
- }
- })
- .catch(function(error) {
- console.error(error);
- });
- })
- .catch(function(Err) {
- console.error(Err);
- });
- } catch (err) {
- console.log(err);
- await member.send("You did not solve the captcha correctly on time.");
- await member.kick();
- }
- } catch (err) {
- console.log(err);
- }
- });
- module.exports.run = async (bot, message, args, prefix, logs) => {
- //Le code suivant sera ici !
- };
- module.exports.command = {
- name: "generate_image",
- aliases: ["image"],
- permission: "none",
- description: "Génère une image avec un texte.",
- usage: "image <langage> <text>",
- args: true,
- args_min: 3,
- need_logs: false,
- category: "INFORMATION",
- enabled: true
- };
- const canvas = require("canvas");
- const ctx = canvas.getContext("2d");
- ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
- ctx.strokeStyle = "#161b28";
- ctx.strokeRect(0, 0, canvas.width, canvas.height);
- ctx.font = "70px sans-serif";
- ctx.fillStyle = "#ffffff";
- ctx.fillText(`${titre}`, 50, 40);
- ctx.beginPath();
- const attachment = new discord.Attachment(canvas.toBuffer(), 'custom__image.png');
- message.channel.send('Test', attachment);
- // conection
- bot.login("NjcwNjk2Nzc3MDgyNzMyNTQ1.XiyJeg.O-RilQvDS6Ov7ZPvBI2Goo7wTRE");
- Object.defineProperty(Array.prototype, "flat", {
- value: function(depth = 1) {
- return this.reduce(function(flat, toFlatten) {
- return flat.concat(
- Array.isArray(toFlatten) && depth > 1
- ? toFlatten.flat(depth - 1)
- : toFlatten
- );
- }, []);
- }
- });
- https://pastebin.com/aW7H5d7c captcha 2/2
Add Comment
Please, Sign In to add comment