From e1d7cc541f878a22a46dbd3f8cc2d0dd5115f16d Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 2 Mar 2018 18:23:12 +0200 Subject: [PATCH] Add setters for non-persistent values that apps might change --- telethon/sessions/abstract.py | 32 ++++++++++++++++++++++++++++++++ telethon/sessions/memory.py | 32 -------------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/telethon/sessions/abstract.py b/telethon/sessions/abstract.py index 89f80b7a..dd1541ab 100644 --- a/telethon/sessions/abstract.py +++ b/telethon/sessions/abstract.py @@ -100,26 +100,50 @@ class Session(ABC): def device_model(self): return self._device_model + @device_model.setter + def device_model(self, value): + self._device_model = value + @property def system_version(self): return self._system_version + @system_version.setter + def system_version(self, value): + self._system_version = value + @property def app_version(self): return self._app_version + @app_version.setter + def app_version(self, value): + self._app_version = value + @property def lang_code(self): return self._lang_code + @lang_code.setter + def lang_code(self, value): + self._lang_code = value + @property def system_lang_code(self): return self._system_lang_code + @system_lang_code.setter + def system_lang_code(self, value): + self._system_lang_code = value + @property def report_errors(self): return self._report_errors + @report_errors.setter + def report_errors(self, value): + self._report_errors = value + @property def time_offset(self): return self._time_offset @@ -132,10 +156,18 @@ class Session(ABC): def flood_sleep_threshold(self): return self._flood_sleep_threshold + @flood_sleep_threshold.setter + def flood_sleep_threshold(self, value): + self._flood_sleep_threshold = value + @property def sequence(self): return self._sequence + @sequence.setter + def sequence(self, value): + self._sequence = value + def get_new_msg_id(self): """Generates a new unique message ID based on the current time (in ms) since epoch""" diff --git a/telethon/sessions/memory.py b/telethon/sessions/memory.py index 92674fa6..71d6e551 100644 --- a/telethon/sessions/memory.py +++ b/telethon/sessions/memory.py @@ -66,38 +66,6 @@ class MemorySession(Session): def salt(self, value): self._salt = value - @property - def device_model(self): - return self._device_model - - @property - def system_version(self): - return self._system_version - - @property - def app_version(self): - return self._app_version - - @property - def lang_code(self): - return self._lang_code - - @property - def system_lang_code(self): - return self._system_lang_code - - @property - def report_errors(self): - return self._report_errors - - @property - def sequence(self): - return self._sequence - - @property - def flood_sleep_threshold(self): - return self._flood_sleep_threshold - def close(self): pass