Haha-Yes/commands/owner/dm.js

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-12-30 03:35:25 +01:00
const { Command } = require('discord-akairo');
class EvalCommand extends Command {
2019-01-02 08:09:45 +01:00
constructor() {
super('dm', {
aliases: ['dm', 'pm'],
category: 'owner',
args: [
{
id: 'user',
type: 'user'
},
{
id: 'text',
2019-01-10 20:45:29 +01:00
type: 'string',
match: 'rest'
2019-01-02 08:09:45 +01:00
}
],
ownerOnly: 'true',
description: {
2018-12-30 03:35:25 +01:00
content: 'DM users',
usage: '[user id] [message]',
examples: ['267065637183029248 hello i recived your feedback and...']
}
2019-01-02 08:09:45 +01:00
});
}
2018-12-30 03:35:25 +01:00
2019-01-02 08:09:45 +01:00
async exec(message, args) {
let user = args.user;
let text = args.text;
2019-01-02 08:09:45 +01:00
let Attachment = (message.attachments).array();
if (Attachment[0]) {
2019-02-25 04:49:56 +01:00
this.client.users.get(user).send(`**Message from the dev:**\n${text}\n${Attachment[0].url}\n**If you wish to respond use the feedback command**`);
2019-01-02 08:09:45 +01:00
message.channel.send(`DM sent to ${user.username}`);
}
else {
2019-02-25 04:49:56 +01:00
this.client.users.get(user.id).send(`**Message from the dev:**\n${text}\n**If you wish to respond use the feedback command**`);
2019-01-02 08:09:45 +01:00
message.channel.send(`DM sent to ${user.username}`);
}
2018-12-30 03:35:25 +01:00
2019-01-02 08:09:45 +01:00
}
2018-12-30 03:35:25 +01:00
}
module.exports = EvalCommand;