how can I check if a message starts with the bot's prefix? Including the bot's mention
Solution
Seeing as this is a follow up from your previous post and you do not have access to the command context you'll have to parse it out manually
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