From c63351ad9e4d858dfb6742b8af5458d6ee7d6614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Jurmanovi=C4=87?= Date: Sun, 13 Mar 2022 11:40:26 +0100 Subject: [PATCH] legica -fixed reactions --- controllers/Client.controller.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/controllers/Client.controller.ts b/controllers/Client.controller.ts index 3e7f181..b88ebcb 100644 --- a/controllers/Client.controller.ts +++ b/controllers/Client.controller.ts @@ -16,16 +16,14 @@ class ClientController { const href = await getFirstHtml(); const { img, title } = await getImgTitle(href); - this.client.channels.cache.forEach((channel) => { + this.client.channels.cache.forEach(async (channel) => { if (channel.type !== "text") return null; const embeddedMessage = new MessageEmbed().setTitle(title).setImage(img); - (channel as TextChannel).send(embeddedMessage).then((_message: Message) => { - _message.react("1"); - _message.react("2"); - _message.react("3"); - _message.react("4"); - _message.react("5"); - }); + const msg = await (channel as TextChannel).send(embeddedMessage); + const reactions = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]; + for (const reaction of reactions) { + await msg.react(reaction); + } }); }; }