forked from embee/woomy
woomy mention prefix support
This commit is contained in:
parent
e5aad749f5
commit
ea52ce2fcf
1 changed files with 12 additions and 4 deletions
|
@ -131,11 +131,19 @@ 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);
|
||||
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue