Send a message when DM could not be sent and fix when sending attachment

merge-requests/3/head
Supositware 5 years ago
parent a2f7969342
commit c8ac210ca9

@ -31,12 +31,22 @@ class EvalCommand extends Command {
let Attachment = (message.attachments).array();
if (Attachment[0]) {
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**`);
message.channel.send(`DM sent to ${user.username}`);
this.client.users.get(user.id).send(`**Message from the dev:**\n${text}\n**If you wish to respond use the feedback command**`, {files: [Attachment[0].url]})
.then(() => {
return message.channel.send(`DM sent to ${user.username}`);
})
.catch(() => {
return message.channel.send(`Could not send a DM to ${user.username}`);
});
}
else {
this.client.users.get(user.id).send(`**Message from the dev:**\n${text}\n**If you wish to respond use the feedback command**`);
message.channel.send(`DM sent to ${user.username}`);
this.client.users.get(user.id).send(`**Message from the dev:**\n${text}\n**If you wish to respond use the feedback command**`)
.then(() => {
return message.channel.send(`DM sent to ${user.username}`);
})
.catch(() => {
return message.channel.send(`Could not send a DM to ${user.username}`);
});
}
}

Loading…
Cancel
Save