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