所以我有代码
if (message.content.startsWith(''))
在我的脚本中,我希望它能使它通过,以便它是大写还是小写。我尝试过
if(message.content.startsWith('>command', '>COMMAND'))
但这没用。有人可以告诉我正确的密码吗?
答案 0 :(得分:3)
您可以先将值更改为小写,然后再进行匹配
message.content.toLowerCase().startsWith(">command")
您可以使用搜索
message.content.seach(/^>command/i)
答案 1 :(得分:0)
将RegExp#test
与RegExp ^>command
(其中^
是start anchor)和flag i
一起使用来忽略大小写。
if(/^>command/i.test(message.content)))