woomy mention prefix support

This commit is contained in:
FLGX 2020-03-19 11:20:18 +01:00
parent e5aad749f5
commit ea52ce2fcf
No known key found for this signature in database
GPG key ID: 999D16475015DDE3

View file

@ -131,12 +131,20 @@ module.exports = async (client, message) => {
}; };
}; };
const prefixMention = new RegExp(`^<@!?${client.user.id}>( |)$`); //const prefixMention = new RegExp(`^<@!?${client.user.id}>( |)$`);
const myMention = `<@&${client.user.id}>`;
const myMention2 = `<@!${client.user.id}>`;
if (message.content.match(prefixMention)) { console.log(message.content);
return message.channel.send(`Current prefix: \`${prefix}\``);
}
if (message.content.startsWith(myMention) || message.content.startsWith(myMention2)) {
if(message.content.length > myMention.length + 1 && (message.content.substr(0, myMention.length + 1) == myMention + ' ' || message.content.substr(0, myMention2.length + 1) == myMention2 + ' ')) {
prefix = message.content.substr(0, myMention.length) + ' ';
} else {
return message.channel.send(`Current prefix: \`${prefix}\``);
};
};
if (message.content.indexOf(prefix) !== 0) return; if (message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g); const args = message.content.slice(prefix.length).trim().split(/ +/g);