mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 14:00:22 +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 = require('./structures/Client');
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
commandPrefix: XIAO_PREFIX,
|
commandPrefix: XIAO_PREFIX,
|
||||||
|
mentionPrefix: false,
|
||||||
owner: OWNERS.split(','),
|
owner: OWNERS.split(','),
|
||||||
invite: INVITE,
|
invite: INVITE,
|
||||||
allowedMentions: {
|
allowedMentions: {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ module.exports = class CommandClient extends Client {
|
|||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.commandPrefix = options.commandPrefix;
|
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.owner = typeof options.owner === 'string' ? [options.owner] : options.owner;
|
||||||
this.invite = options.invite || null;
|
this.invite = options.invite || null;
|
||||||
this.registry = new Registry(this);
|
this.registry = new Registry(this);
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ module.exports = class CommandDispatcher {
|
|||||||
get commandPattern() {
|
get commandPattern() {
|
||||||
if (this._commandPattern) return this._commandPattern;
|
if (this._commandPattern) return this._commandPattern;
|
||||||
const prefix = this.client.commandPrefix;
|
const prefix = this.client.commandPrefix;
|
||||||
|
const mention = `<@!?${this.client.user.id}>\\s+(?:${prefix}}\\s*)?|`;
|
||||||
this._commandPattern = new RegExp(
|
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;
|
return this._commandPattern;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user