From dc15a285e779caf83aa90ba2695acb61267cfeea Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 15 Apr 2021 01:22:16 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5=20Basic=20update=20for=20Royalnet?= =?UTF-8?q?=206.3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 8 ++++---- pyproject.toml | 4 ++-- royalnet-telethon.iml | 5 ++++- royalnet_telethon/pda.py | 15 ++++++++++++++- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/poetry.lock b/poetry.lock index 14e0db50..5817430d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -284,7 +284,7 @@ socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] [[package]] name = "royalnet" -version = "6.2.10" +version = "6.3.0" description = "A multipurpose bot framework" category = "main" optional = false @@ -510,7 +510,7 @@ brotli = ["brotlipy (>=0.6.0)"] [metadata] lock-version = "1.1" python-versions = "^3.8" -content-hash = "f393839bc9bc0910f6ca4e3e1441fe69242dceb10ff23afd14ca97c80e6f1bff" +content-hash = "810f936889f968120ea5bd1e6d0f7f467d338ee6ac2514bb1ccb49bdb318fb0b" [metadata.files] alabaster = [ @@ -747,8 +747,8 @@ requests = [ {file = "requests-2.25.1.tar.gz", hash = "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"}, ] royalnet = [ - {file = "royalnet-6.2.10-py3-none-any.whl", hash = "sha256:794d2f2c5d319a1649cf97355d7ad07c0ad36df4d96b4ad534eb1dc1c4a39caa"}, - {file = "royalnet-6.2.10.tar.gz", hash = "sha256:1a3f87b77fccce8df7571fcd0d8fbc5837b9f173a6d15c5e1e3e679a377b8ba5"}, + {file = "royalnet-6.3.0-py3-none-any.whl", hash = "sha256:f2f6ea15def33e27ca92a0ba3b7863fab7b7339bcbb99bc83f6be74bd8e805e6"}, + {file = "royalnet-6.3.0.tar.gz", hash = "sha256:6301ef60a1402ec59e55a206462f5b7296c5f6bbd6ab0bf38851ede42add5b20"}, ] rsa = [ {file = "rsa-4.7.2-py3-none-any.whl", hash = "sha256:78f9a9bf4e7be0c5ded4583326e7461e3a3c5aae24073648b4bdfa797d78c9d2"}, diff --git a/pyproject.toml b/pyproject.toml index 5396d289..964c2f74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "royalnet-telethon" -version = "0.3.4" +version = "1.0.0" description = "A Telethon-based frontend for the royalnet.engineer module." authors = ["Stefano Pigozzi "] license = "AGPL-3.0-or-later" @@ -18,7 +18,7 @@ classifiers = [ [tool.poetry.dependencies] python = "^3.8" -royalnet = "~6.2.10" +royalnet = "~6.3.0" Telethon = "^1.21.1" click = "^7.1.2" diff --git a/royalnet-telethon.iml b/royalnet-telethon.iml index 1379ee46..1353155b 100644 --- a/royalnet-telethon.iml +++ b/royalnet-telethon.iml @@ -2,7 +2,10 @@ - + + + + diff --git a/royalnet_telethon/pda.py b/royalnet_telethon/pda.py index 3d361acc..61b91d3c 100644 --- a/royalnet_telethon/pda.py +++ b/royalnet_telethon/pda.py @@ -43,7 +43,7 @@ class TelethonPDAImplementation(engi.ConversationListImplementation): return "telethon" def __init__(self, name: str, tg_api_id: int, tg_api_hash: str, bot_username: str, bot_token: str, - mode: TelethonPDAMode = TelethonPDAMode.CHAT_USER, extensions = None): + mode: TelethonPDAMode = TelethonPDAMode.CHAT_USER, extensions=None): super().__init__(name=name, extensions=extensions) @@ -83,6 +83,11 @@ class TelethonPDAImplementation(engi.ConversationListImplementation): .. todo:: Document this. """ + self.error_reporting_chat: int = error_reporting_chat + """ + .. todo:: Document this. + """ + def _register_events(self, client): """ .. todo:: Document this. @@ -168,6 +173,14 @@ class TelethonPDAImplementation(engi.ConversationListImplementation): finally: await client.disconnect() + async def _handle_conversation_exc( + self, + dispenser: engi.Dispenser, + conv: engi.ConversationProtocol, + exception: Exception, + ) -> None: + self.log.error(f"Unhandled exception in {dispenser} running {conv}: {exception}") + __all__ = ( "TelethonPDAImplementation",