mirror of
https://github.com/danbulant/Shasha
synced 2026-06-07 08:32:16 +00:00
Use regex
This commit is contained in:
parent
bfff9e5610
commit
cc02562a38
1 changed files with 12 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const commando = require("@iceprod/discord.js-commando");
|
const commando = require("@iceprod/discord.js-commando");
|
||||||
const { getUser, errLog, ranLog, trySend } = require("../../resources/functions");
|
const { ranLog, trySend, cleanMentionID, findMemberRegEx } = require("../../resources/functions");
|
||||||
|
|
||||||
module.exports = class uinfo extends commando.Command {
|
module.exports = class uinfo extends commando.Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
|
|
@ -12,12 +12,17 @@ module.exports = class uinfo extends commando.Command {
|
||||||
description: "\"Detailed\" Profile."
|
description: "\"Detailed\" Profile."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async run(msg, arg ) {
|
async run(msg, arg) {
|
||||||
const args = arg.trim().split(/ +/);
|
|
||||||
try {
|
try {
|
||||||
let profile;
|
let profile,
|
||||||
if (args[0]) {
|
hmm;
|
||||||
profile = await getUser(this.client, msg, args[0]);
|
if (arg.length > 0) {
|
||||||
|
hmm = cleanMentionID(arg);
|
||||||
|
if (/^\d{17,19}$/.test(hmm)) {
|
||||||
|
profile = this.client.users.cache.get(hmm);
|
||||||
|
} else {
|
||||||
|
profile = findMemberRegEx(msg, hmm)[0].user;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
profile = msg.author;
|
profile = msg.author;
|
||||||
}
|
}
|
||||||
|
|
@ -35,7 +40,7 @@ module.exports = class uinfo extends commando.Command {
|
||||||
trySend(this.client, msg, result, {split:{maxLength:2000,char: ", " || ",\n" || ". " || ".\n" || "," || ".",append:',```',prepend:'```js\n'}});
|
trySend(this.client, msg, result, {split:{maxLength:2000,char: ", " || ",\n" || ". " || ".\n" || "," || ".",append:',```',prepend:'```js\n'}});
|
||||||
return ranLog(msg,'profile', msg.content);
|
return ranLog(msg,'profile', msg.content);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return errLog(e, msg, this.client, false, 'Gimme the right ID!', true);
|
return trySend(this.client, msg, "Ya lookin for ya lover? 404 not found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Loading…
Reference in a new issue