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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
module.exports = {
name: 'dm',
aliases: ['directmessage'],
description: '',
execute(msg, args, bot) {
if (msg.author) { // TODO: fix discord not evaluating args[1]
if (!msg.mentions.users.first() && !args[1]) {
msg.reply('you haven\'t specified a user or a message.');
} else if (!args[1]) {
msg.reply('you haven\'t specified anything to send.');
} else if (!msg.mentions.users.first()) {
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.fetchMember(sendTo, false).then(messageUser => {
messageUser.send(args[0])
let emb = new Discord.RichEmbed()
//.setDescription(`to view the commands in each group use:\n\`s5n!commands <group>\``)
.addField(`message`, args[1], true)
.addField(`recipient`, args[0], true)
.addField(`time sent`, d)
.setColor(0xF97DAE);
msg.channel.send(RichEmbed = emb);
});
}
// This shit took about an hour and a half to debug because I couldn't figure out how to convert the first arguement into
// a user id. After getting help from discord.js Discord I fixed it for about 30 seconds at 21:26 and then I broke it again instantlly
// after. Then I tried to fix everything and I almost broke everything again but I realized it was broken because I did s5n!dm instead
// of s5n!test and I hadn't ported the code over from test to. 2020/04/02, 21:34
//where sendTo and d went
//args[0] = args[0].id
//msg.reply(args[0]);
// args[0];
// msg.reply(typeof args[0]) // for debugging
// const collector = new Discord.MessageCollector(msg.channel, m => m.author.id === msg.author.id, {
// time: 5000
// });
// msg.reply('timed out', 5000)
// //console.log(collector)
// collector.on('collect', message => {
// var messageText = message.content;
// if (msg.member.message) {
// msg.reply('received')
// }
// })
// msg.reply('what would you like to say?');
// if (msg.member.lastMessage) {
// var messageText = msg.member.lastMessage.content;
// }
// where send function went
} else {
msg.reply('insufficent perms bruh');
}
}
};
|