summaryrefslogtreecommitdiff
path: root/commands/fun/dm.js
blob: 472af1e309bbbcefbde89b10d7fbf26d4e3213ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('demojijs');

module.exports = class DMFun extends Command {
    constructor(client) {
        super(client, {
            name: 'dm',
            aliases: ['directmessage', 'direct-message'],
            group: 'fun',
            memberName: 'dm',
            description: 'dm someone',
            guildOnly: true,
            args: [
                {
                    key: 'msgContent',
                    prompt: 'what would u like to send',
                    type: 'string'
                }
            ]
        });
    }
    run(msg, { msgContent }) {
        if (msg.author) {
            if (!msg.mentions.users.first() && msgContent) {
                msg.reply('you haven\'t specified anyone to send a dm to.');
            } else {
                var sendTo = msg.mentions.users.first().id;
                var d = new Date(msg.createdTimestamp);

                msg.guild.members.fetch(sendTo, false).then(messageUser => {
                    messageUser.send(msgContent);
                    msg.reply('sent :D');
                });
            }
        } else {
            msg.reply('insufficent perms bruh');
        }
    }
};