Using bot mention as prefix

This commit is contained in:
Christer Warén 2020-03-28 02:49:52 +02:00
parent bf0e0aaf03
commit eeb703da2a

View File

@ -3,6 +3,7 @@ module.exports = {
async execute(client, msg, Discord) { async execute(client, msg, Discord) {
if (msg.author.bot || !msg.guild) return; if (msg.author.bot || !msg.guild) return;
let prefix = client.config.prefix; let prefix = client.config.prefix;
if(msg.mentions.members.first().user.id === client.user.id){ prefix = "<@!" + client.user.id + "> "; }
const args = msg.content.slice(prefix.length).split(' '); const args = msg.content.slice(prefix.length).split(' ');
if (!msg.content.startsWith(prefix)) return; if (!msg.content.startsWith(prefix)) return;
if (!args[0]) return; if (!args[0]) return;