javascript (node:7764)实验警告:缓冲区,文件是一项实验性功能,可能随时更改

qv7cva1a  于 2023-02-07  发布在  Java
关注(0)|答案(1)|浏览(167)

对不起,我的英语,我试图编码一个不和谐的机器人发送验证码的新成员,如果验证码是好的我的机器人给他们一个角色,它的工作,但在它得到的角色后,我的机器人崩溃与此错误消息:console error image语音监控代码:

const { Client, IntentsBitField, EmbedBuilder } = require("discord.js");
const client = new Client({
    intents: [
        IntentsBitField.Flags.Guilds,
        IntentsBitField.Flags.GuildMessages,
        IntentsBitField.Flags.MessageContent, //IMPORTANT: make sure you enable "Message Content Intent" in the dev portal!
        IntentsBitField.Flags.GuildMembers,
        IntentsBitField.Flags.DirectMessages,
    ]
});

client.login("bot tk");

const { Captcha } = require("discord.js-captcha");

client.on("ready", () => {
    console.log("Bot opérationnel");
});

const captcha = new Captcha(client, {
    roleID: "role id", //optional
    channelID: "channel id", //optional
    sendToTextChannel: true, //optional, defaults to false
    addRoleOnSuccess: true, //optional, defaults to true. whether you want the bot to add the role to the user if the captcha is solved
    kickOnFailure: true, //optional, defaults to true. whether you want the bot to kick the user if the captcha is failed
    caseSensitive: true, //optional, defaults to true. whether you want the captcha responses to be case-sensitive
    attempts: 3, //optional, defaults to 1. number of attempts before captcha is considered to be failed
    timeout: 300000, //optional, defaults to 60000. time the user has to solve the captcha on each attempt in milliseconds
    showAttemptCount: true, //optional, defaults to true. whether to show the number of attempts left in embed footer
    customPromptEmbed: new EmbedBuilder(), //customise the embed that will be sent to the user when the captcha is requested
    customSuccessEmbed: new EmbedBuilder(), //customise the embed that will be sent to the user when the captcha is solved
    customFailureEmbed: new EmbedBuilder(), //customise the embed that will be sent to the user when they fail to solve the captcha
});

client.on("guildMemberAdd", async member => {
    //in your bot application in the dev portal, make sure you have intents turned on!
    captcha.present(member); //captcha is created by the package, and sent to the member
});

captcha.on("success", data => {
    console.log(`Un membre a réussie le captcha !`);
    console.log(data);
});

captcha.on("failure", data => {
    console.log(`Un membre a raté le captcha !`);
    console.log(data);
});

谢谢你帮我!

8nuwlpux

8nuwlpux1#

该错误特别涉及到您的node.js,这是关于node.js的警告,该功能可能会更改或在node.js的未来被删除,它是不稳定的。
你可以忽略这个警告,因为它只是与实验特性相关,但是你可以通过在你的文件顶部执行process.noDeprecation = true;来抑制它,这是主要原因。

相关问题