forked from Supositware/Haha-Yes
Allow sending attachment
This commit is contained in:
parent
60a82d06fd
commit
e7986dacfd
1 changed files with 13 additions and 2 deletions
|
@ -33,6 +33,12 @@ class fakebotCommand extends Command {
|
|||
}
|
||||
|
||||
async exec(message, args) {
|
||||
let Attachment = (message.attachments).array();
|
||||
let url;
|
||||
// Get attachment link
|
||||
if (Attachment[0]) {
|
||||
url = Attachment[0].url;
|
||||
}
|
||||
|
||||
message.channel.createWebhook(args.member.username, {
|
||||
avatar: args.member.displayAvatarURL(),
|
||||
|
@ -48,7 +54,12 @@ class fakebotCommand extends Command {
|
|||
this.client.fetchWebhook(webhook.id, webhook.token)
|
||||
.then(webhook => {
|
||||
message.delete();
|
||||
|
||||
if (url)
|
||||
webhook.send(args.message, {files: [url]});
|
||||
else
|
||||
webhook.send(args.message);
|
||||
|
||||
setTimeout(() => {
|
||||
webhook.delete();
|
||||
}, 3000);
|
||||
|
|
Loading…
Reference in a new issue