Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Case sensitivity?

I have a command, `!echo`, that I would like to run even if someone accidentally types `!Echo`. I'd rather not upload the same API twice, is it possible to write an API to listen for more than one command?
1603957976
GiGs
Pro
Sheet Author
API Scripter
yes, it is - it's also possible to ignore the case in the text you are checking. If you post the line where you are checking the input text, we can show you how to modify it to avoid this issue.
1603972360
The Aaron
Roll20 Production Team
API Scripter
I generally use a case-insensitive matching regular expression: if( /^!echo(\b\s|$)/i.test(msg.content) ) { but you could lowercase: if( msg.content.toLowerCase().startsWith("!echo") ) {
1604071991

Edited 1604072015
Here's the code I have in my api: if('api' === msg.type && msg.content.match(/^!fate/) ){
1604072269
The Aaron
Roll20 Production Team
API Scripter
if('api' === msg.type && msg.content.match(/^!fate/ i ) ){