visual-studio-2010 - Visual Studio 代码终端 - 类型错误:无法读取未定义的属性“执行”
问题描述
嗨,我在使用Visual Studio 代码时遇到问题,终端显示TypeError: Cannot read property 'execute' of undefined谢谢
有人可以帮忙 - [1]:https ://i.stack.imgur.com/Ax2Ra.png
for(const file of commandFiles){
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
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);
}
if (command == 'youtube'){
client.commands.get('youtube').execute(message, args);
}
if (command == 'instagram'){
client.commands.get('instagram').execute(message, args);
}
});
解决方案
改变这一行:
if (command === 'ping'){
client.commands.get('ping').execute(message, args);
}
到这一行:
if (command == 'ping'){
client.commands.get('ping').execute(message, args);
}
推荐阅读
- powerapps - Microsoft PowerApp - OR 函数
- scipy - scipy 无法读取 Sympy .coeff_all() 返回的列表
- python - 更改数据框列名称而不更改类型
- c# - 如何使用 JsonConvert+attribute 序列化字典以隐藏字典名称?
- android - 在运行时将network_security_config.xml的域名设置为localhost
- acumatica - 如何访问自定义字段,该字段在构造功能包 - Acumatica 中定义
- python - 使用 pd.to_numeric 丢失数据
- bluej - 中断异常和IO异常有什么区别以及如何使用它们(两者)
- c# - Why is this regex replace statement failing to do anything?
- excel - Xpath解释