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,
roleChanged: boolean
}
function getChatMemberUpdateStatus(oldMember: ChatMember, newMember: ChatMember): ChatMemberUpdateStatus {
return {
joined: oldMember.status === "left" &&
@ -74,7 +73,7 @@ export const init = (bot: Bot<Ctx>, db: Kysely<Database>, cfg: CompiledConfig) =
// TODO:
// const userInfo = await checkUserOnNewChatMember(ctx, db, botCfg)
//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}:'+
'${ctx.from.first_name} ${ctx.from.last_name}`)
await onMemberLeftChat(ctx, db)