mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
Only take mentions in name rate
This commit is contained in:
@@ -27,7 +27,7 @@ module.exports = class NameRaterCommand extends Command {
|
|||||||
max: 25,
|
max: 25,
|
||||||
default: msg => msg.author.username,
|
default: msg => msg.author.username,
|
||||||
validate: async name => {
|
validate: async name => {
|
||||||
const matches = name.match(/^(?:<@!?)?([0-9]+)>?$/);
|
const matches = name.match(/^(?:<@!?)([0-9]+)>$/);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
try {
|
try {
|
||||||
const user = await this.client.users.fetch(matches[1]);
|
const user = await this.client.users.fetch(matches[1]);
|
||||||
@@ -40,7 +40,7 @@ module.exports = class NameRaterCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
parse: name => {
|
parse: name => {
|
||||||
const matches = name.match(/^(?:<@!?)?([0-9]+)>?$/);
|
const matches = name.match(/^(?:<@!?)([0-9]+)>$/);
|
||||||
if (matches) return this.client.users.cache.get(matches[1]) || null;
|
if (matches) return this.client.users.cache.get(matches[1]) || null;
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user