且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Discord js/检查用户是否在特定的语音频道中

更新时间:2023-11-30 12:07:52

问题是

if (voiceChannelID === '789186504483536937', '791444742042943548')

这不是多个条件的工作方式.用 or 操作符分隔.

This is not how multiple conditionals work. Seperate it with the or operator.

if (voiceChannelID === '789186504483536937' || voiceChannelID === '791444742042943548')

您可以将您尝试做的事情想象为传入两个不同的条件 f(x, y).Javascript 中的 if 语句将只检查最后一个 (y) 和791444742042943548".是真实的,因为它是非空的.

You can think of what you were trying to do as passing in two different conditions, f(x, y). If statements in Javascript will only check for the last one (y), and "791444742042943548" is truthy since it is non-null.