30 lines
839 B
JavaScript
30 lines
839 B
JavaScript
|
const Revolt = require('revolt.js');
|
||
|
const { client, logger, config } = require('..');
|
||
|
|
||
|
module.exports.meta = {
|
||
|
name: 'whois',
|
||
|
aliases: [ 'userinfo', 'who' ],
|
||
|
description: 'Shows user info in JSON.'
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* @param { Revolt.Message } message
|
||
|
* @param { string[] } args
|
||
|
*/
|
||
|
module.exports.run = async (message, args) => new Promise(async (resolve, reject) => {
|
||
|
let uid = args[0];
|
||
|
if (!uid)
|
||
|
return client.channels.sendMessage(message.channel, 'Please <@mention> the target user or type their ID.');
|
||
|
|
||
|
|
||
|
if (uid.startsWith('<@') && uid.endsWith('>')) uid = uid.substr(2, uid.length - 3);
|
||
|
|
||
|
const target = await client.users.fetch(uid)
|
||
|
.catch(e => { return reject(e) });
|
||
|
|
||
|
let msgContent =
|
||
|
`${JSON.stringify(target)}`
|
||
|
|
||
|
await client.channels.sendMessage(message.channel, msgContent);
|
||
|
});
|