message.member.roles
returns a manager for the roles belonging to this member, so you need to use the .cache
property to return the roles. .cache
returns a Collection that doesn't have an .includes()
method. I think you were looking for the .has()
property that checks if an element exists in the collection:
if (!message.member.roles.cache.has(validrole.id)) {
return message.channel.send(`**${message.author}, You do not have permission to use this command**`)
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…