bringing back forgotten awaits
This commit is contained in:
parent
ade154b169
commit
0084abc4b8
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user