mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +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,
|
||||
default: msg => msg.author.username,
|
||||
validate: async name => {
|
||||
const matches = name.match(/^(?:<@!?)?([0-9]+)>?$/);
|
||||
const matches = name.match(/^(?:<@!?)([0-9]+)>$/);
|
||||
if (matches) {
|
||||
try {
|
||||
const user = await this.client.users.fetch(matches[1]);
|
||||
@@ -40,7 +40,7 @@ module.exports = class NameRaterCommand extends Command {
|
||||
return true;
|
||||
},
|
||||
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;
|
||||
return name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user