Send a message when DM could not be sent and fix when sending attachment
This commit is contained in:
parent
a2f7969342
commit
c8ac210ca9
1 changed files with 14 additions and 4 deletions
|
@ -31,12 +31,22 @@ class EvalCommand extends Command {
|
||||||
|
|
||||||
let Attachment = (message.attachments).array();
|
let Attachment = (message.attachments).array();
|
||||||
if (Attachment[0]) {
|
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**`);
|
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]})
|
||||||
message.channel.send(`DM sent to ${user.username}`);
|
.then(() => {
|
||||||
|
return message.channel.send(`DM sent to ${user.username}`);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
return message.channel.send(`Could not send a DM to ${user.username}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.client.users.get(user.id).send(`**Message from the dev:**\n${text}\n**If you wish to respond use the feedback command**`);
|
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}`);
|
.then(() => {
|
||||||
|
return message.channel.send(`DM sent to ${user.username}`);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
return message.channel.send(`Could not send a DM to ${user.username}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue