Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当提到用户时,命令不起作用_Javascript_Node.js_Discord_Discord.js - Fatal编程技术网

Javascript 当提到用户时,命令不起作用

Javascript 当提到用户时,命令不起作用,javascript,node.js,discord,discord.js,Javascript,Node.js,Discord,Discord.js,我有一段代码,返回一个丰富的嵌入,其中包含提到的用户或消息作者的头像,如果没有提及,代码可以不提及,但提及某人时不起作用。控制台中没有错误 如果message.content==前缀+化身{ const user=message.indications.users.first if!message.notices.users.size{ const Embed=new Discord.MessageEmbed .setAuthormessage.author.tag,message.author

我有一段代码,返回一个丰富的嵌入,其中包含提到的用户或消息作者的头像,如果没有提及,代码可以不提及,但提及某人时不起作用。控制台中没有错误


如果message.content==前缀+化身{ const user=message.indications.users.first if!message.notices.users.size{ const Embed=new Discord.MessageEmbed .setAuthormessage.author.tag,message.author.avatarURL .setColor13e2c0 setTitleAvatar先生 .setImagemessage.author.avatarURL message.channel.sendebed } const Embed=new Discord.MessageEmbed .setAuthoruser.tag,user.avatarURL .setColor13e2c0 setTitleAvatar先生 .setImageuser.avatarURL message.channel.sendebed }
如果没有用户提及,message.sinetions.users.size将始终为0,而不是NULL或未定义

如果message.content.toLowerCase.startsWithprefix+avatar{ const user=message.indications.users.first | | message.author; const Embed=new Discord.MessageEmbed .setAuthoruser.tag,user.avatarURL .setColor13e2c0.setTitleAvatar .setImageuser.avatarURL 返回message.channel.sendEmbed; }
当提到某人时,该命令仍然不起作用,它会像更改它之前一样继续。我可以获取您当前使用的脚本吗?如果message.content==prefix+avatar{const user=message.intriends.users.first | | message.author;const Embed=new Discord.MessageEmbed.setAuthoruser.tag,user.avatarURL.setColor13e2c0.setTitleAvatar.setImageuser.avatarURL message.channel.sendEmbed;}这是因为你正在检查消息是否完全等于!avatar,where!是前缀。当你提到某人时,消息看起来像!avatar。我已经更新了我的代码,请告诉我你是否仍然遇到这个问题。它有效!非常感谢你,我真的不明白toLowerCase是什么意思。