User kicked handling added

This commit is contained in:
Dmitry Anderson 2024-10-27 22:31:20 +01:00
parent c6b48dd0d6
commit ade154b169

View File

@ -17,7 +17,6 @@ interface ChatMemberUpdateStatus {
restricted: boolean, restricted: boolean,
roleChanged: boolean roleChanged: boolean
} }
function getChatMemberUpdateStatus(oldMember: ChatMember, newMember: ChatMember): ChatMemberUpdateStatus { function getChatMemberUpdateStatus(oldMember: ChatMember, newMember: ChatMember): ChatMemberUpdateStatus {
return { return {
joined: oldMember.status === "left" && joined: oldMember.status === "left" &&
@ -74,7 +73,7 @@ export const init = (bot: Bot<Ctx>, db: Kysely<Database>, cfg: CompiledConfig) =
// TODO: // TODO:
// const userInfo = await checkUserOnNewChatMember(ctx, db, botCfg) // const userInfo = await checkUserOnNewChatMember(ctx, db, botCfg)
//if (userInfo.isNewUser) { /* Some hello message? */ } //if (userInfo.isNewUser) { /* Some hello message? */ }
} else if (chatMemberUpdateStatus.left) { } else if (chatMemberUpdateStatus.left || chatMemberUpdateStatus.kicked) {
console.log(`Chat member left ${ctx.chatMember.from.id}:'+ console.log(`Chat member left ${ctx.chatMember.from.id}:'+
'${ctx.from.first_name} ${ctx.from.last_name}`) '${ctx.from.first_name} ${ctx.from.last_name}`)
await onMemberLeftChat(ctx, db) await onMemberLeftChat(ctx, db)