modmail/structure/commands/Id.js

28 lines
590 B
JavaScript
Raw Normal View History

const Command = require('../Command');
class ModmailID extends Command {
2021-10-22 09:35:04 +02:00
constructor (client) {
super(client, {
name: 'id',
2021-10-22 09:35:04 +02:00
aliases: [ 'mmid' ]
});
}
2021-10-22 09:35:04 +02:00
async execute (message, { args }) {
let channel = null;
2022-03-23 13:39:31 +01:00
if (args?.length) channel = await this.client.resolveChannel(args[0]);
else ({ channel } = message);
2022-03-23 13:39:31 +01:00
const result = this.client.getUserFromChannel(channel);
if (result.error) return result;
2021-10-22 09:35:04 +02:00
const [ userId ] = result;
return userId;
}
}
module.exports = ModmailID;