简体   繁体   English

尝试分配角色时,我不断收到错误消息

[英]I keep receiving a error when trying to give roles

I have a small piece of code that reads from a mongodb database and give them the role in the database我有一小段代码从 mongodb 数据库中读取并赋予它们在数据库中的角色

The command requires the user to tag the person they wish to update, what am i doing wrong?该命令要求用户标记他们希望更新的人,我做错了什么?

msg.mentions.members.first().addRole(msg.guild.roles.find(r => r.name === result[0].MainRank));

This is the error:这是错误:

 TypeError: msg.guild.roles.find is not a function

You now have to use msg.guild.roles.cache.find , since v12 uses Managers.您现在必须使用msg.guild.roles.cache.find ,因为 v12 使用管理器。

暂无
暂无

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

相关问题 尝试将文件上传到Google云端硬盘时,请继续收到“登录所需”错误 - Keep receiving Login Required error when trying to upload a file to Google Drive 尝试登录我的应用程序时不断收到 401 错误 - I keep getting a 401 error when trying to login to my app 尝试使用 localhost 进行测试时收到错误消息 - Receiving an error when trying to test with localhost 我正在尝试让 discord 机器人根据有人加入服务器后的时间赋予角色 - I'm trying to make a discord bot give roles base on the time since somebody has joined the server 当用户点击卡片时尝试显示卡片详细信息,但收到我传递的道具的“未定义”错误 - Trying to show card details when a user clicks on a card but receiving "not defined" error for the props I am passing in 为什么即使我不尝试解析,node.js 也会给我一个解析错误? - Why does node.js give me a parsing error even when I'm not trying to parse? 当我尝试打开“update_item”页面时,我不断收到此错误 - I keep getting this error when I'm trying to open the 'update_item' page 尝试选择对象并使用js添加click事件时收到错误 - Receiving error when trying to select object and add click event with js discord.js - 尝试检索用户 ID of.repliedUser 时出现接收错误 - discord.js - Receiving error when trying to retrieve userID of .repliedUser 尝试运行 .js 文件,但收到错误消息: - Trying to run a .js file but I'm receiving an error:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM