fixed filters
This commit is contained in:
parent
ef2e9791e8
commit
28dad77a80
|
@ -3,7 +3,7 @@ import time
|
||||||
|
|
||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
import asyncio
|
import asyncio
|
||||||
from telethon.tl.types import UserStatusOnline, UserStatusOffline
|
from telethon.tl.types import UserStatusOnline, UserStatusOffline, UserStatusRecently
|
||||||
|
|
||||||
from app.models.user import User
|
from app.models.user import User
|
||||||
from paper.parser import PaperParser
|
from paper.parser import PaperParser
|
||||||
|
@ -60,9 +60,11 @@ def parse_users_task(self, task_id: int):
|
||||||
|
|
||||||
is_active = False
|
is_active = False
|
||||||
if isinstance(user.status, UserStatusOffline):
|
if isinstance(user.status, UserStatusOffline):
|
||||||
is_active = user.status.was_online + datetime.timedelta(day=5) >= datetime.now()
|
was_online = user.status.was_online.replace(tzinfo=datetime.timezone.utc)
|
||||||
|
today = datetime.datetime.today().replace(tzinfo=datetime.timezone.utc)
|
||||||
|
is_active = was_online + datetime.timedelta(days=5) >= today
|
||||||
|
|
||||||
if isinstance(user.status, UserStatusOnline):
|
if isinstance(user.status, UserStatusOnline) or isinstance(user.status, UserStatusRecently):
|
||||||
is_active = True
|
is_active = True
|
||||||
|
|
||||||
if not is_active:
|
if not is_active:
|
||||||
|
|
Loading…
Reference in New Issue