21 lines
696 B
JavaScript
21 lines
696 B
JavaScript
const { client, logger, config } = require('..');
|
|
|
|
module.exports = async (input) => {
|
|
try {
|
|
let output;
|
|
if (input.startsWith('<@') && input.endsWith('>'))
|
|
output = input.substr(2, input.length - 3);
|
|
else {
|
|
if (input.startsWith('@')) input = input.substr(1);
|
|
if (client.users.get(input))
|
|
output = input;
|
|
else
|
|
output = client.users.toArray().find(user => user.username?.toLowerCase() === input?.toLowerCase())?._id;
|
|
}
|
|
if (!output) output = input;
|
|
return await client.users.fetch(output)
|
|
.catch(()=>{});
|
|
} catch(e) {
|
|
console.error(e);
|
|
}
|
|
} |