From 0084abc4b839bda2b1fc0cf19b44e7c5e7623a90 Mon Sep 17 00:00:00 2001 From: Dmitry Anderson <4nd3r5z0n@gmail.com> Date: Mon, 28 Oct 2024 18:00:10 +0100 Subject: [PATCH] bringing back forgotten awaits --- bot/normal_mode/user_managment.ts | 8 ++++---- core/users.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bot/normal_mode/user_managment.ts b/bot/normal_mode/user_managment.ts index 1c20af5..327e117 100644 --- a/bot/normal_mode/user_managment.ts +++ b/bot/normal_mode/user_managment.ts @@ -129,16 +129,16 @@ export const checkUserOnNewChatMember = async ( const { expect_user_tg_id } = inviteLinksData[0] out.isExpectedUserJoined = expect_user_tg_id === ctx.chatMember.from.id out.expectedUserTgId = expect_user_tg_id - db.deleteFrom('invite_links').where('link', '=', invite_link).execute() - ctx.revokeChatInviteLink(invite_link) + await db.deleteFrom('invite_links').where('link', '=', invite_link).execute() + await ctx.revokeChatInviteLink(invite_link) } if (!out.isExpectedUserJoined) { - db.updateTable('users').where(eb => eb.or([ + await db.updateTable('users').where(eb => eb.or([ eb('tg_id', '=', out.expectedUserTgId), eb('tg_id', '=', ctx.chatMember.from.id), ])).execute() - ctx.banChatMember(ctx.chatMember.from.id).catch() + await ctx.banChatMember(ctx.chatMember.from.id).catch() } return out diff --git a/core/users.ts b/core/users.ts index 5189dc9..a6309d5 100644 --- a/core/users.ts +++ b/core/users.ts @@ -35,7 +35,7 @@ export const getActiveInviteLink = async ( const now = new Date() const link = invite_links[0] if (link.valid_until && link.valid_until < now) { - db.deleteFrom('invite_links') + await db.deleteFrom('invite_links') .where('link', '=', link.link).execute() return }