Javascript 我想列出对不和做出反应的用户。对于Discord.js
我想列出对不和做出反应的用户Javascript 我想列出对不和做出反应的用户。对于Discord.js,javascript,discord,discord.js,Javascript,Discord,Discord.js,我想列出对不和做出反应的用户 let MyChannel = client.channels.get('573534660852711426'); MyChannel.fetchMessage('656352072806957066').then(themessage => { for (const reaction of themessage.reactions){ for (let user of reaction.users){
let MyChannel = client.channels.get('573534660852711426');
MyChannel.fetchMessage('656352072806957066').then(themessage => {
for (const reaction of themessage.reactions){
for (let user of reaction.users){
console.log(user);
}
console.log(reaction);
}
});
这是我的代码,但不起作用。你能帮我吗
谢谢。您需要使用
Reaction.fetchUsers
。试试这样:
让MyChannel=client.channels.get('573534660852711426');
MyChannel.fetchMessage('656352072806957066')。然后(异步themessage=>{
for(消息反应的常量反应){
for(让wait reaction.fetchUsers()的用户{
console.log(用户);
}
控制台日志(反应);
}
});
我用
await reaction.fetchUsers()
编辑了reaction.users
,并添加了async
,因为await
必须在异步函数中使用。运行代码时出现的错误如下所示
at F:\js\index.js:41:37
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:23364) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:23364) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
38 let MyChannel = bot.channels.get('648985076817985556');
39 MyChannel.fetchMessage('650431271436156969').then(async themessage => {
40 for (const reaction of themessage.reactions){
41 for (let user of await reaction.fetchUsers()){
42 console.log(user);
43 }
44 console.log(reaction);
45 }
46 });
当你说它不起作用时,它会给你一个错误,一个不正确的答案,还是什么都没有发生?