from aiogram import types from load import dp, bot, config from database.worker import delete @dp.message_handler(is_chat=True, content_types=['left_chat_member']) async def on_left(message: types.Message): user_id = message.from_user.id delete(user_id) await message.delete()