简体   繁体   English

在 discord.js 中获得带有角色反应的警告

[英]Getting Warnings with Role Reaction in discord.js

Hey I recently started programming a discord bot.嘿,我最近开始编写 discord 机器人。 But now I have a problem.但现在我有一个问题。 I'm trying to get a role reaction but somehow I keep getting errors.我试图获得角色反应,但不知何故,我不断收到错误。 I'm going to link you errors and my code so maybe someone can help me.我将把你的错误和我的代码链接起来,所以也许有人可以帮助我。

Warnings: https://hastebin.com/ativekefod.sql警告: https://hastebin.com/ativekefod.sql

MessageReactionAddEvent.js: https://hastebin.com/nababomuta.js MessageReactionAddEvent.js: https://hastebin.com/nababomuta.js

Thanks for any help!谢谢你的帮助!

you are retrieving 3 parameters when only 2 are given, messageReaction and user ,当只给出 2 个参数时,您正在检索 3 个参数messageReactionuser

https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-messageReactionAdd https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-messageReactionAdd

So essentially you are calling.message on a user class.所以基本上你是在用户 class 上调用.message。

Change the run function to:将运行 function 更改为:

async run(client, reaction, user);

And then your message variable would be:然后您的消息变量将是:

const message = reaction.message;

It's possible it's different depending on your event handler but this is most likely it根据您的事件处理程序,它可能会有所不同,但这很可能是

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM