您可以检查包含所需通道列表的数组是否包含当前通道:
if ([/* channel IDs */].includes(message.channel.id)) {
// do stuff
}
或者,如果要改用通道名称:
if ([/* channel names */].includes(message.channel.name)) {
// do stuff
}
查看该id是否等于您只想使用命令进行以下操作的通道id:
if (message.channel.id === 'Wanted channel id') {
// your command stuff
}
或按姓名:
if (message.channel.name === 'Wanted channel name') {
// your command stuff
}
(不是想听起来很粗鲁)你应该先看一些教程,然后再去堆栈溢出处理类似的事情。