summaryrefslogtreecommitdiff
path: root/commands/dm.js
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-07 10:21:53 -0700
committer8cy <[email protected]>2020-04-07 10:21:53 -0700
commit3c8023f23931f8573bdf27ed8f3e674c04ff7eaa (patch)
treeade3a418304befa9f8576128ea7dc595b590273e /commands/dm.js
parentadd yt test, 1.3.0 (diff)
downloads5nical-3c8023f23931f8573bdf27ed8f3e674c04ff7eaa.tar.xz
s5nical-3c8023f23931f8573bdf27ed8f3e674c04ff7eaa.zip
port all the stuff from app.js to commands/
Diffstat (limited to 'commands/dm.js')
-rw-r--r--commands/dm.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/commands/dm.js b/commands/dm.js
new file mode 100644
index 0000000..edd8a0a
--- /dev/null
+++ b/commands/dm.js
@@ -0,0 +1,66 @@
+module.exports = {
+ name: 'dm',
+ 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');
+ }
+ }
+} \ No newline at end of file