我需要在您运行“!overwide”之类的命令时进行设置,这样只有您指定的人才能看到频道,而不是整个角色。这是我到目前为止的代码。我尝试了很多不同的写作方式。
const { Message } = require("discord.js")
module.exports = { name:'afellow', description: "give a specific person",
execute(message, args, Discord) {
let memberToFind = message.mentions.members.first();
let channels = [
'810951137287995495',
'810952727529127946',
]
if (!channels) return message.channel.send('N/A')
if (!memberToFind) return message.channel.send('Mention a user!')
if(message.member.roles.cache.find(r => r.name === "FellowshipOwner")) {
message.channel.updateOverwrite(memberToFind, { VIEW_CHANNEL: true, SEND_MESSAGES: true }).catch();
} else {
message.channel.send('Sorry, You must be a fellowship owner to use this command.')
}
}
}
答案 0 :(得分:1)
由于您已经拥有您提到的成员的成员对象,您可以通过提及该对象的变量来简单地更新它们在频道中的覆盖。
P.S:我在您当前的工作中添加了更多代码并修复了您遇到的一些常规错误。
+ + string