【发布时间】:2022-01-19 00:00:29
【问题描述】:
嘿,我想检查一个用户是否有一个角色,尽管所有其他方法都已经过时了,而且我已经尝试了一些方法,但都不起作用。
我的尝试:
var guild = client.guilds.cache.get("Guild ID")
var buyerRole = guild.roles.cache.get("Role ID")
await guild.members.fetch()
const guildMember = guild.members.cache.get(message.author.id)
if(guildMember.roles.find(buyerRole.id)){...
【问题讨论】:
-
是roles.cache.find,你只用ID所以用roles.cache.has
-
但是
find()接受一个函数,而不是一个 ID,所以可能是roles.cache.has(buyerRole.id) -
@ZsoltMeszaros
TypeError: authorMember.roles.find is not a function:( -
@MrMythical
TypeError: authorMember.roles.has is not a function
标签: node.js discord.js