检查发送的消息以及用户和消息是否正确 我正在做一个机器人,但是,如果某个人说“代码>:p,我想给变量加1。我该怎么做?我试过author.id,但它一直说它没有定义。谢谢 const Discord = require('discord.js')

检查发送的消息以及用户和消息是否正确 我正在做一个机器人,但是,如果某个人说“代码>:p,我想给变量加1。我该怎么做?我试过author.id,但它一直说它没有定义。谢谢 const Discord = require('discord.js'),discord.js,Discord.js,检查发送的消息以及用户和消息是否正确 我正在做一个机器人,但是,如果某个人说“代码>:p,我想给变量加1。我该怎么做?我试过author.id,但它一直说它没有定义。谢谢 const Discord = require('discord.js'); const client = new Discord.Client(); const prefix = '-'; const fs = require('fs'); numberofp

检查发送的消息以及用户和消息是否正确

我正在做一个机器人,但是,如果某个人说“代码>:p<代码>,我想给变量加1。我该怎么做?我试过

author.id
,但它一直说它没有定义。谢谢


    const Discord = require('discord.js');
    const client = new Discord.Client();
     
    const prefix = '-';
     
    const fs = require('fs');
    numberofp = 0
    client.commands = new Discord.Collection();
     
    const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
    for(const file of commandFiles){
        const command = require(`./commands/${file}`);
     
        client.commands.set(command.name, command);
    }
     
     
     
    client.once('ready', () => {
        console.log('rub do be online!');
    });
     
     
    client.on('message', message =>{
     
     
     
        if(!message.content.startsWith(prefix) || message.author.bot) return;
     
        const args = message.content.slice(prefix.length).split(/ +/);
        const command = args.shift().toLowerCase();
     
        if (command === 'ping'){
            client.commands.get('ping').execute(message, args, Discord);
        } 
        if (command === 'help'){
            client.commands.get('help').execute(message, args, Discord);
        } 
        if (command === 'rub'){
            client.commands.get('rub').execute(message, args, Discord);
        }
    });
     
     
    client.login('removed for privacy reasons');
     
     
    -------------------------------rub.js-------------------------------
    module.exports = {
        name: 'rub',
        description: "Embeds!",
        execute(message, args, Discord) {
            const newEmbed = new Discord.MessageEmbed()
            .setColor('#34BDE1')
            .setTitle('rub')
            .addFields(
                {name: 'the number of times blank said :p', value: numberofp}, 
     
            )
            .setFooter('Made posible by porsha_boy!', 'https://i.imgur.com/ObLAtBb.png');
     
            message.channel.send(newEmbed);
        }
    }
     
     
    -------------------------------ping.js-------------------------------
    module.exports = {
        name: 'ping',
        description: "this is a ping command!",
        execute(message, args){
     
     
     
     
     
     
            if(message.member.roles.cache.has('846851397398822973')){
                message.channel.send('pong!');
     
     
     
            } else {
                message.channel.send('You dont seem to have the @member role, contact my discord or the server owner for more information');
                message.member.roles.add('846851397398822973').catch(console.error)
     
            }
        }
    }
     
     
    -------------------------------command.js-------------------------------
     
    module.exports = {
        name: 'help',
        description: "Embeds!",
        execute(message, args, Discord) {
            const newEmbed = new Discord.MessageEmbed()
            .setColor('#34BDE1')
            .setTitle('Rules')
            .setDescription('This is a embed for the server rules')
            .addFields(
                {name: 'List of commands:', value: 'All the commands that work on this bot will be stated here!'}, 
                {name :'-help', value: 'used to help you!'},
                {name: '-rub', value: 'used to tell you the amount of times blank used words like :p'},
                {name: '-fap', value: 'used to tell you the amount of times blank used words like :p'},
                {name: '-can', value: 'used to tell you the amount of times blank used words like :p'},
                {name: '-porshe', value: 'used to tell you the amount of times blank used words like :p'}
     
            )
            .setFooter('Made posible by porsha_boy!', 'https://i.imgur.com/ObLAtBb.png');
     
            message.channel.send(newEmbed);
        }
    }
     


你的代码是什么?代码在粘贴箱上,因为它太长了:tl;博士,我是说你的病是什么?我们可以复制的最短数量来获得您的问题。我真正需要帮助的唯一部分就是弄清楚机器人将如何检查输入的人是否是A)正确的人,以及B)他们输入的内容是否等同于:pOk。。。但请编辑你的问题,使其只包含你需要帮助的部分