Reputation: 53
So I have the code
if (message.content.startsWith(''))
in my script and I want it to make it so it goes through if it is uppercase OR lowercase. I tried
if(message.content.startsWith('>command', '>COMMAND'))
but that didn't work. Can someone tell me the correct code?
Upvotes: 3
Views: 1694
Reputation: 115222
Use RegExp#test
with RegExp ^>command
(where ^
is start anchor) and flag i
for ignoring case.
if(/^>command/i.test(message.content)))
Upvotes: 0
Reputation: 37755
You can change the value to lowercase first before matching
message.content.toLowerCase().startsWith(">command")
You can use search
message.content.seach(/^>command/i)
Upvotes: 2