summaryrefslogtreecommitdiff
path: root/src/commands/fun/dm.js
blob: fc10f28e7be8561dc8f04af126f778a708054a16 (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
40
41
42
43
44
45
46
47
48
49
50
51
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');

module.exports = class DMFun extends Command {
    constructor(client) {
        super(client, {
            name: 'dm',
            aliases: [
                'directmessage',
                'directmsg',
                'direct-message',
                'direct-msg'
            ],
            group: 'fun',
            memberName: 'dm',
            description: 'dm someone',
            guildOnly: true,
            args: [
                {
                    key: 'msgContent',
                    prompt: 'what would u like to send',
                    type: 'string'
                }
            ],
            examples: [
                's5n!dm @sin#1337 hi',
                's5n!directmessage @sin#1337 hey',
                's5n!directmsg @sin#1337 hello',
                's5n!direct-message @sin#1337 yo',
                's5n!direct-msg @sin#1337 aye',
            ]
        });
    }
    run(msg, { msgContent }) {
        if (msg.author) {
            if (!msg.mentions.users.first() && msgContent) {
                msg.reply('you haven\'t specified anyone to send 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');
        }
    }
};