Код:
import logging
from aiogram import Bot, Dispatcher, types
from aiogram.types import ParseMode
from aiogram.utils import executor
from aiogram.dispatcher.filters import ChatMembersFilter
TOKEN = ''
USER_ID = ''
bot = Bot(token=TOKEN)
dp = Dispatcher(bot)
async def send_notification(user: types.User):
await bot.send_message(chat_id=USER_ID, text=f"{user.full_name} вошел(а) в сеть")
@dp.message_handler(ChatMembersFilter(is_chat_member=False), content_types=types.ContentType.ANY)
async def on_user_joined(message: types.Message):
user = message.from_user
await send_notification(user)
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)
Ошибка:
line 5, in <module>
from aiogram.dispatcher.filters import ChatMembersFilter
ImportError: cannot import name 'ChatMembersFilter' from 'aiogram.dispatcher.filters'