const possiblePrefixes = ['!', '<@PUT_YOUR_CLIENT_ID_HERE_FOR_THE_MENTION>', 'etc'];
const msg = {
content: '!mycommand myoptions'
};
let startsWithPrefix = false;
for (let prefix of possiblePrefixes) {
if (msg.content.startsWith(prefix)) {
startsWithPrefix = true;
break;
}
}
console.log(startsWithPrefix); // prints true if msg.content starts with one of the possiblePrefixes
const possiblePrefixes = ['!', '<@PUT_YOUR_CLIENT_ID_HERE_FOR_THE_MENTION>', 'etc'];
const msg = {
content: '!mycommand myoptions'
};
let startsWithPrefix = false;
for (let prefix of possiblePrefixes) {
if (msg.content.startsWith(prefix)) {
startsWithPrefix = true;
break;
}
}
console.log(startsWithPrefix); // prints true if msg.content starts with one of the possiblePrefixes