Haha-Yes/commands/owner/dm.js
2018-11-05 00:12:32 +01:00

38 lines
No EOL
1.1 KiB
JavaScript

const { Command } = require('discord.js-commando');
module.exports = class dmCommand extends Command {
constructor(client) {
super(client, {
name: 'dm',
group: 'owner',
memberName: 'dm',
description: 'Dm the user id',
ownerOnly: true,
args: [
{
key: 'id',
prompt: 'Wich user would you like to dm?',
type: 'string',
},
{
key: 'text',
prompt: 'Wich user would you like to dm?',
type: 'string',
default: ''
}
]
});
}
async run(message, { id, text }) {
let Attachment = (message.attachments).array();
const user = this.client.users.get(id);
if (Attachment[0]) {
user.send(`**Message from the dev**\n${text}\n${Attachment[0].url}`)
message.say('DM sent')
}
else {
user.send(`**Message from the dev**\n${text}`)
message.say('DM sent')
}
}
};