Shashank3736 / captcha-canvas

A captcha generator by using skia-canvas.
https://captcha-canvas.js.org
Apache License 2.0
61 stars 12 forks source link

WARNING: lavapipe is not a conformant vulkan implementation, testing use only. #51

Closed Jakub30cz closed 1 year ago

Jakub30cz commented 1 year ago

I am getting this warning message everytime I turn on my discord.js bot. Any ideas?

Shashank3736 commented 1 year ago

I think you are in wrong place. This module should not cause a problem as big as that.

Jakub30cz commented 1 year ago

I think you are in wrong place. This module should not cause a problem as big as that.

But I think this warning message is there after I added this module. If not, do you have any idea or solution?

Shashank3736 commented 1 year ago

It may came because of it's dependency on skia-canvas. Which OS you are using?

Jakub30cz commented 1 year ago

I am running code on VPS.

Jakub30cz commented 1 year ago

I will try something today and then I will text here.

Shashank3736 commented 1 year ago

It seems your VPS is not allowing the use of resourses. You may have to upgrade your current plan or you can try if canvas works there. If yes, then you can use v2

Jakub30cz commented 1 year ago

I have tried to reinstall skia-canvas and it still gives me this warning message. How much is this warning important?

Shashank3736 commented 1 year ago

If you are using this for a personal use and a really small project then you can pretty much ignore it but if you are using it for some big projects I recommend you to consult your VPS provider regarding the upper limits and other details.

Jakub30cz commented 1 year ago

I tried to ask VPS support and nothing important. Can you check my code please? @Shashank3736

`const { EmbedBuilder, AttachmentBuilder } = require("discord.js"); const verifyDB = require("../../Schemas/Verification"); const { Captcha } = require("captcha-canvas");

module.exports = { name: 'guildMemberAdd', once: false,

async execute(member, client) {
    const guildId = member.guild.id;

    const captcha = new Captcha(); //create a captcha canvas of 100x300.
    captcha.async = false
    captcha.addDecoy();
    captcha.drawTrace();
    captcha.drawCaptcha();

    let verifyData = await verifyDB.findOne({ Guild: guildId })

    if (!verifyData) { return; }
            let roleDB = verifyData.RoleID

    const captchaPicture = new AttachmentBuilder(await captcha.png, { name: 'captcha.png' });

    const verifyEmbed = new EmbedBuilder()
        .setTitle(`${member.guild.name} verification!`)
        .setDescription(`Reply with a message containing the correct characters (connected by a line) from the captcha image`)
        .setColor("Random")
        .setThumbnail(member.user.displayAvatarURL())
        .setFooter({ iconURL: client.user.displayAvatarURL(), text: client.user.tag })
        .setImage(`attachment://${captchaPicture.name}`)

    let msg;
    try {
        msg = await member.send({ embeds: [verifyEmbed], files: [captchaPicture] });
    } catch (err) { return console.log("Message failure: " + err) }

    const filter = (message) => {
        if (message.author.id !== member.id) return false;
        if (message.content === captcha.text) return true;
        else { member.send("Wrong!"); return false; }
    }

    try {
        let response = await msg.channel.awaitMessages({ filter, max: 1, time: 300000, errors: ['time'] });
        if (response) {
            let role = member.guild.roles.cache.find(role => role.id == roleDB);
            member.roles.add(role)
            return member.send({
                embeds: [new EmbedBuilder().setFooter({ iconURL: client.user.displayAvatarURL(), text: client.user.tag })
                    .setColor("Green")
                    .setTitle("You have been verified! ✅")
                    .setDescription(`Access to ${member.guild.name} has been granted. Enjoy 😄`)]
            })
        }

    } catch (e) { console.log("Verify" + e) }

}

}`

Thank you in advance for trying to help

Shashank3736 commented 1 year ago

I don't see any issue with your code. And also the warning about the code or package but about your uses. I guess you should be fine to ignore the warnings for now