From ef1253f87f4e9833fd4521e634979e3575918ea3 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 6 Jun 2021 14:59:34 -0400 Subject: [PATCH] No mention prefix --- Xiao.js | 1 + framework/Client.js | 1 + framework/Dispatcher.js | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Xiao.js b/Xiao.js index 7f726ac5..a2faaccc 100644 --- a/Xiao.js +++ b/Xiao.js @@ -6,6 +6,7 @@ const { Intents, MessageEmbed } = require('discord.js'); const Client = require('./structures/Client'); const client = new Client({ commandPrefix: XIAO_PREFIX, + mentionPrefix: false, owner: OWNERS.split(','), invite: INVITE, allowedMentions: { diff --git a/framework/Client.js b/framework/Client.js index fdfd6ea7..de5490aa 100644 --- a/framework/Client.js +++ b/framework/Client.js @@ -12,6 +12,7 @@ module.exports = class CommandClient extends Client { super(options); this.commandPrefix = options.commandPrefix; + this.mentionPrefix = typeof options.mentionPrefix === 'undefined' ? true : Boolean(options.mentionPrefix); this.owner = typeof options.owner === 'string' ? [options.owner] : options.owner; this.invite = options.invite || null; this.registry = new Registry(this); diff --git a/framework/Dispatcher.js b/framework/Dispatcher.js index 9c6d7416..ae34533a 100644 --- a/framework/Dispatcher.js +++ b/framework/Dispatcher.js @@ -11,8 +11,9 @@ module.exports = class CommandDispatcher { get commandPattern() { if (this._commandPattern) return this._commandPattern; const prefix = this.client.commandPrefix; + const mention = `<@!?${this.client.user.id}>\\s+(?:${prefix}}\\s*)?|`; this._commandPattern = new RegExp( - `^(<@!?${this.client.user.id}>\\s+(?:${prefix}}\\s*)?|${prefix}\\s*)([^\\s]+)`, 'i' + `^(${this.client.mentionPrefix ? mention : ''}${prefix}\\s*)([^\\s]+)`, 'i' ); return this._commandPattern; }