diff --git a/.gitignore b/.gitignore index 1cd05e4..d970ed4 100644 --- a/.gitignore +++ b/.gitignore @@ -131,4 +131,7 @@ dmypy.json .pyre/ # Test Files -tests/ \ No newline at end of file +tests/ + +*.session +*.session-journal \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index b5803e5..8549352 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pyrogram -telethon -tgcrypto -nest_asyncio \ No newline at end of file +pyrogram==2.0.103 +telethon==1.28.5 +tgcrypto==1.2.5 +nest_asyncio==1.5.6 \ No newline at end of file diff --git a/run.bat b/run.bat index 2b144c2..98e0596 100644 --- a/run.bat +++ b/run.bat @@ -3,7 +3,7 @@ TITLE Releasing the library echo Installing dependencies... pip install -r requirements-dev.txt echo Bumping up library version... -bumpversion --allow-dirty --current-version 0.2.0 minor setup.py telegramdb/constants.py run.bat +bumpversion --allow-dirty --current-version 1.0.0 minor setup.py telegramdb/constants.py run.bat run.sh echo Building the package... python setup.py sdist bdist_wheel echo Uploading the package... diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..c38baab --- /dev/null +++ b/run.sh @@ -0,0 +1,5 @@ +pip install -r requirements-dev.txt +bumpversion --allow-dirty --current-version 1.0.0 minor setup.py telegramdb/constants.py run.bat run.sh +python setup.py sdist bdist_wheel +twine upload dist/* +del /Q dist \ No newline at end of file diff --git a/setup.py b/setup.py index 9931319..526bcce 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='TelegramDB', - version='0.2.0', + version='1.0.0', description='A library that uses your telegram account as a database for your project.', long_description=long_description, long_description_content_type="text/markdown", diff --git a/telegram/__init__.py b/telegram/__init__.py deleted file mode 100644 index 22a07f1..0000000 --- a/telegram/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -import warnings -warnings.warn("Use of 'telegram' for importing is deprecated! Please use 'telegramdb' instead.", DeprecationWarning, - stacklevel=2) -from telegramdb import * diff --git a/telegramdb/__init__.py b/telegramdb/__init__.py index 8062696..f503f99 100644 --- a/telegramdb/__init__.py +++ b/telegramdb/__init__.py @@ -1,5 +1,5 @@ # TelegramDB -# Copyright (C) 2022 +# Copyright (C) 2023 # Anony # This program is free software: you can redistribute it and/or modify diff --git a/telegramdb/constants.py b/telegramdb/constants.py index 6b7db0a..88d667d 100644 --- a/telegramdb/constants.py +++ b/telegramdb/constants.py @@ -1,5 +1,5 @@ # TelegramDB -# Copyright (C) 2022 +# Copyright (C) 2023 # Anony # This program is free software: you can redistribute it and/or modify @@ -16,4 +16,4 @@ DP_NAME_SEPARATOR = '::' -VERSION = "0.2.0" \ No newline at end of file +VERSION = "1.0.0" \ No newline at end of file diff --git a/telegramdb/database.py b/telegramdb/database.py index 55f8288..da2b656 100644 --- a/telegramdb/database.py +++ b/telegramdb/database.py @@ -1,5 +1,5 @@ # TelegramDB -# Copyright (C) 2022 +# Copyright (C) 2023 # Anony # This program is free software: you can redistribute it and/or modify @@ -110,7 +110,7 @@ class TelegramDB: __dp_cache__:dict = {} def __init__(self, telegram_client: Union[Client, TelegramClient], chat_id: Union[int, str]=None, debug: bool=False, logger: Logger=None): print(f""" - TelegramDB v{VERSION} Copyright (C) 2022 anonyindian + TelegramDB v{VERSION} Copyright (C) 2023 anonyindian This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. @@ -183,7 +183,7 @@ def __publish_data__(self, datapack: DataPack, data:str): if msg_id == 0: async def publish(): nonlocal msg_id - msg_id = (await client.send_message(chat_id=self.__chat_id__, text=data)).message_id + msg_id = (await client.send_message(chat_id=self.__chat_id__, text=data)).id self.__loop__.run_until_complete(publish()) self.__commit_success__ = True else: @@ -338,7 +338,7 @@ def __get_datapacks__(self): """ if isinstance(self.__telegram_client__, Client): from pyrogram.types import Message - for message in self.__telegram_client__.iter_history(self.__chat_id__): + for message in self.__telegram_client__.get_chat_history(self.__chat_id__): message: Message = message if not message.text: continue diff --git a/telegramdb/exceptions.py b/telegramdb/exceptions.py index 733e6c7..7eb67ad 100644 --- a/telegramdb/exceptions.py +++ b/telegramdb/exceptions.py @@ -1,5 +1,5 @@ # TelegramDB -# Copyright (C) 2022 +# Copyright (C) 2023 # Anony # This program is free software: you can redistribute it and/or modify diff --git a/venv.sh b/venv.sh new file mode 100644 index 0000000..0c8ecd1 --- /dev/null +++ b/venv.sh @@ -0,0 +1 @@ +py -m venv env && env/bin/activate && pip install -r requirements.txt \ No newline at end of file