rgiessmann / telegram-copy-messages

Copy Telegram messages from one chat to another
MIT License
6 stars 2 forks source link

Syntax Error #1

Open stutraveler opened 3 months ago

stutraveler commented 3 months ago

I just found your repository and it's exactly what I was looking for. Thanks for creating this wonderful little tool.

I am getting an error message as follows when I run the main.py , could you please check. This is at Step 3 when I have put in the App ID and the HASH and trying to retrieve the Chat ID's.

File "main.py", line 73 def copy_message(from_chat_id: int, to_chat_id: int, message_id: int, send_copy: bool = True) -> None: ^ SyntaxError: invalid syntax

Screenshot attached.

Screenshot 2024-08-04 113653

rgiessmann commented 3 months ago

Hi there! Glad that it helps! :)

Which Python version do you use? I had something like 3.7 at least, I guess, maybe it's this?

Best, Robert

stutraveler commented 3 months ago

Thanks for the super prompt reply. I installed Ubuntu 18 and that has Python 2.7.17 , what distribution and version do you use. I will use the same :)

stutraveler commented 3 months ago

I used Python3 now and got along a few more steps. python-telegram-client is needed and when I try to install it I get the following error.


Could not find a version that satisfies the requirement telegram-text~=0.1 (from python-telegram-client) (from versions: ) No matching distribution found for telegram-text~=0.1 (from python-telegram-client)

Full error below:

manik@manik-Standard-PC-i440FX-PIIX-1996:~/telegram-copy-messages-main$ python3 main.py Traceback (most recent call last): File "main.py", line 29, in from telegram.client import Telegram ModuleNotFoundError: No module named 'telegram.client' manik@manik-Standard-PC-i440FX-PIIX-1996:~/telegram-copy-messages-main$ pip install python-telegram-client Collecting python-telegram-client Using cached https://files.pythonhosted.org/packages/62/df/410512ea863819067d4d15854dd2dae8d1e943773cb695a6ac0477904813/python_telegram_client-0.17.0.post0-py2.py3-none-any.whl Collecting telegram-text~=0.1 (from python-telegram-client) Could not find a version that satisfies the requirement telegram-text~=0.1 (from python-telegram-client) (from versions: ) No matching distribution found for telegram-text~=0.1 (from python-telegram-client)

rgiessmann commented 3 months ago

The easiest to install all requirements should be to execute, in the directory where main.py is:

pip install -r requirements.txt

Let me know if it works! :)

stutraveler commented 3 months ago

I did that already. Same error.

Collecting python-dotenv==0.13.0 (from -r requirements.txt (line 1)) Using cached https://files.pythonhosted.org/packages/cb/2a/07f87440444fdf2c5870a710b6770d766a1c7df9c827b0c90e807f1fb4c5/python_dotenv-0.13.0-py2.py3-none-any.whl Collecting python-telegram==0.17.0 (from -r requirements.txt (line 2)) Using cached https://files.pythonhosted.org/packages/a0/e5/1bc2ac5fcf666fcb35ff55e442dca50d99b13287772d65ffa681ecbf4e72/python-telegram-0.17.0.tar.gz Collecting telegram-text==0.1.1 (from -r requirements.txt (line 3)) Could not find a version that satisfies the requirement telegram-text==0.1.1 (from -r requirements.txt (line 3)) (from versions: ) No matching distribution found for telegram-text==0.1.1 (from -r requirements.txt (line 3))

stutraveler commented 3 months ago

If you could let me know what Linux Version you use and I could try the same.

rgiessmann commented 3 months ago

How strange! Would you mind trying

pip install telegram-text

?

rgiessmann commented 3 months ago

I used Debian and Python 3.10, I guess. If you'd like, you can try Docker as well, as it fixes all of that in the background, but I am not sure if you really want to go down that alley...

stutraveler commented 3 months ago

Will try. I did try pip install telegram-text.

pip install telegram-text Collecting telegram-text Could not find a version that satisfies the requirement telegram-text (from versions: ) No matching distribution found for telegram-text

rgiessmann commented 3 months ago

Sorry I can't look into this in more detail right now, as we are on vacation. That's really strange behavior of the packages.

Here you find the package itself: https://pypi.org/project/telegram_text/0.1.1/#files

You might be able to install it from the .whl file provided there, or you might be able to try to write the pip install telegram_text (with underscore)? No idea.

Maybe you can also just install newer versions, maybe they are still compatible. If you install them manually, the script wouldn't ask nor check for the version, so maybe it would work.

Sorry to let you down -- I can look into it next week in more detail, if it still makes sense for you. Let me know!