mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
No mention prefix
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user