const tChannel = member.guild.channels.find(c => c.name === `ticket-${mAuthor.username}`)
我希望message.author只能在其票务频道中使用该命令。
答案 0 :(得分:0)
由于信息有限,您似乎想在成员使用该命令时随时检查频道。一种简单的解决方案是在用户ID上键入一个map
,其值是用户ID。像这样:
bot.on("message", function(message){
const userChannelID = channelMap[message.author.id]
if(userChannelID === message.channel.name){
//Execute command here
}
else{
message.channel.send("You are not authorized to use this command in this channel")
}
}