From c95f7eddae742dcd94a4d33a12dee8190193bbe3 Mon Sep 17 00:00:00 2001 From: Vladimir <18351400+en9inerd@users.noreply.github.com> Date: Sat, 5 Oct 2024 22:35:40 -0400 Subject: [PATCH] fix: delete all messages from conversation with user --- requirements-dev.txt | 54 ++++++++++++++++++++++---------------------- requirements.txt | 4 ++-- tgeraser/eraser.py | 12 ++++++++++ 3 files changed, 41 insertions(+), 29 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index a248baf..9e9e073 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,53 +1,53 @@ -i https://pypi.org/simple -astroid==3.2.2; python_full_version >= '3.8.0' +astroid==3.3.5; python_full_version >= '3.9.0' backports.tarfile==1.2.0; python_version < '3.12' -black==24.4.2; python_version >= '3.8' -certifi==2024.6.2; python_version >= '3.6' +black==24.8.0; python_version >= '3.8' +certifi==2024.8.30; python_version >= '3.6' charset-normalizer==3.3.2; python_full_version >= '3.7.0' checksumdir==1.2.0; python_version >= '3.6' and python_version < '4.0' click==8.1.7; python_version >= '3.7' detect-secrets==1.5.0 -dill==0.3.8; python_version >= '3.11' +dill==0.3.9; python_version >= '3.11' docutils==0.21.2; python_version >= '3.9' -idna==3.7; python_version >= '3.5' -importlib-metadata==7.1.0; python_version >= '3.8' +idna==3.10; python_version >= '3.6' +importlib-metadata==8.5.0; python_version >= '3.8' iniconfig==2.0.0; python_version >= '3.7' isort==5.13.2; python_full_version >= '3.8.0' jaraco.classes==3.4.0; python_version >= '3.8' -jaraco.context==5.3.0; python_version >= '3.8' -jaraco.functools==4.0.1; python_version >= '3.8' -keyring==25.2.1; python_version >= '3.8' +jaraco.context==6.0.1; python_version >= '3.8' +jaraco.functools==4.1.0; python_version >= '3.8' +keyring==25.4.1; python_version >= '3.8' markdown-it-py==3.0.0; python_version >= '3.8' mccabe==0.7.0; python_version >= '3.6' mdurl==0.1.2; python_version >= '3.7' -more-itertools==10.2.0; python_version >= '3.8' -mypy==1.10.0; python_version >= '3.8' +more-itertools==10.5.0; python_version >= '3.8' +mypy==1.11.2; python_version >= '3.8' mypy-extensions==1.0.0; python_version >= '3.5' -nh3==0.2.17 -packaging==24.0; python_version >= '3.7' +nh3==0.2.18 +packaging==24.1; python_version >= '3.8' pathspec==0.12.1; python_version >= '3.8' -pkginfo==1.11.1; python_version >= '3.8' -platformdirs==4.2.2; python_version >= '3.8' +pkginfo==1.10.0; python_version >= '3.6' +platformdirs==4.3.6; python_version >= '3.8' pluggy==1.5.0; python_version >= '3.8' pygments==2.18.0; python_version >= '3.8' -pylint==3.2.3; python_full_version >= '3.8.0' +pylint==3.3.1; python_full_version >= '3.9.0' pynt==0.8.2 pynt-contrib==0.2.0 -pytest==8.2.2; python_version >= '3.8' -pyyaml==6.0.1; python_version >= '3.6' -readme-renderer==43.0; python_version >= '3.8' +pytest==8.3.3; python_version >= '3.8' +pyyaml==6.0.2; python_version >= '3.8' +readme-renderer==44.0; python_version >= '3.9' requests==2.32.3; python_version >= '3.8' requests-toolbelt==1.0.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' rfc3986==2.0.0; python_version >= '3.7' -rich==13.7.1; python_full_version >= '3.7.0' -tomlkit==0.12.5; python_version >= '3.7' -twine==5.1.0; python_version >= '3.8' +rich==13.9.2; python_full_version >= '3.8.0' +tomlkit==0.13.2; python_version >= '3.8' +twine==5.1.1; python_version >= '3.8' typing-extensions==4.12.2; python_version >= '3.8' -urllib3==2.2.1; python_version >= '3.8' -vulture==2.11; python_version >= '3.8' -zipp==3.19.2; python_version >= '3.8' +urllib3==2.2.3; python_version >= '3.8' +vulture==2.13; python_version >= '3.8' +zipp==3.20.2; python_version >= '3.8' docopt==0.6.2 pyaes==1.6.1 -pyasn1==0.6.0; python_version >= '3.8' +pyasn1==0.6.1; python_version >= '3.8' rsa==4.9; python_version >= '3.6' and python_version < '4' -telethon==1.35.0; python_version >= '3.5' +telethon==1.37.0; python_version >= '3.5' diff --git a/requirements.txt b/requirements.txt index bb4b4b7..3bca176 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -i https://pypi.org/simple docopt==0.6.2 pyaes==1.6.1 -pyasn1==0.6.0; python_version >= '3.8' +pyasn1==0.6.1; python_version >= '3.8' rsa==4.9; python_version >= '3.6' and python_version < '4' -telethon==1.35.0; python_version >= '3.5' +telethon==1.37.0; python_version >= '3.5' diff --git a/tgeraser/eraser.py b/tgeraser/eraser.py index 4266217..85a8406 100644 --- a/tgeraser/eraser.py +++ b/tgeraser/eraser.py @@ -124,6 +124,18 @@ async def _delete_messages_from_entities(self) -> None: ) for entity in self.__entities: + if isinstance(entity, User): + print_header( + f"Deleting messages from conversation with user {get_display_name(entity)}..." + ) + + await self.delete_dialog(entity.id, revoke=True) + + print( + f"\nDeleted all messages from conversation with user {get_display_name(entity)}.\n" + ) + continue + display_name = get_display_name(entity) print_header(f"Getting messages from '{display_name}'...") messages_to_delete = [