From 696520306e1e2b2c61834b3135033d0a12f7eebd Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 19 Jul 2020 12:52:17 +0200 Subject: [PATCH] Await for me --- src/commands/reply.ts | 2 +- src/events/messageCreate.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/reply.ts b/src/commands/reply.ts index 5472d2a2..aed921ee 100644 --- a/src/commands/reply.ts +++ b/src/commands/reply.ts @@ -7,7 +7,7 @@ import { MessageFile } from 'eris'; export default new Command('reply', async (caller, cmd, userDB) => { if (!cmd.args[0] && cmd.msg.attachments.length === 0) return caller.utils.discord.createMessage(cmd.channel.id, 'You must provide a reply.'); const files: MessageFile[] = []; - if (cmd.msg.attachments.length > 0) for (const file of cmd.msg.attachments) Axios.get(file.url, { responseType: 'arraybuffer' }) + if (cmd.msg.attachments.length > 0) for (const file of cmd.msg.attachments) await Axios.get(file.url, { responseType: 'arraybuffer' }) .then((response) => files.push({ file: response.data, name: file.filename })) .catch(() => false); diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index dfe98f86..bc8b7fb8 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -18,7 +18,7 @@ export default async (caller: Caller, msg: Message): Promise => { if (blacklist?.includes(msg.author.id)) return; const files: MessageFile[] = []; - if (msg.attachments.length > 0) for (const file of msg.attachments) Axios.get(file.url, { responseType: 'arraybuffer' }) + if (msg.attachments.length > 0) for (const file of msg.attachments) await Axios.get(file.url, { responseType: 'arraybuffer' }) .then((response) => files.push({ file: response.data, name: file.filename })) .catch(() => false);