命令未运行且没有错误消息

问题描述

我试图为我的不和谐机器人运行多个命令,由于某种原因,一个单一的命令没有运行。这是我的 main.js 文件中的代码

client.on('message',message => {
    if(!message.content.startsWith(prefix) || message.author.bot) return
    const args = message.content.slice(prefix.length).trim().split(' ');
    const command = args.shift().toLowerCase();

    if(command === 'petFeed') {
        client.commands.get('petFeed').execute(message,args,discord);
    }else if(command === 'petwater') {
        client.commands.get('petwater').execute(message,discord); 
        //this is one of the commands that runs perfectly fine. The command has virtually identical code to the petFeed command in its file but with a few small changes
});

这是我要运行的命令:

const db = require('quick.db')

module.exports = {
    name: 'petFeed',description: 'Feeds your pet',execute: async (message,discord) => {
        let user = message.author
        let fullness = await db.fetch(`fullness_${user.id}`)
        let food = await db.fetch(`food_${user.id}`)

        if(fullness === null) fullness = 0;
        if(food === null) food = 0;
        
        if(fullness < 3 && food >= 1) {
            db.add(`fullness_${user.id}`,1)
            db.subtract(`food_${user.id}`,1)
        }
    }
}

我还有其他非常相似的命令,它们运行得非常好,但是当我尝试运行该命令时,它什么也没做,也不会返回任何错误

解决方法

在 main.js 文件和命令文件中将名称更改为 petfood 以某种方式解决了该问题。如果我将它改回 petfeed,它会再次停止工作。