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 }