Nekmo / telegram-upload

Upload and download files from Telegram up to 4 GiB using your account
MIT License
1.1k stars 237 forks source link

using --to option not work for private channel #163

Closed alirezaimi closed 1 year ago

alirezaimi commented 2 years ago

Description

How in interactive mode (-i) send file to private channel works perfectly and send file to channel but when i use with --to option with channel id or invite link or username of channel but give me an error !?

What I Did

with channel id :

# telegram-upload a.py --to "-10015195XXXXXX"
Traceback (most recent call last):
  File "/usr/local/bin/telegram-upload", line 8, in <module>
    sys.exit(upload_cli())
  File "/usr/local/lib/python3.9/dist-packages/telegram_upload/exceptions.py", line 64, in wrap
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/telegram_upload/management.py", line 174, in upload
    client.send_files(to, files, delete_on_success, print_file_id, forward)
  File "/usr/local/lib/python3.9/dist-packages/telegram_upload/client.py", line 183, in send_files
    message = self._send_file_message(entity, file, thumb, progress)
  File "/usr/local/lib/python3.9/dist-packages/telegram_upload/client.py", line 133, in _send_file_message
    message = self.send_file(entity, file, thumb=thumb,
  File "/usr/local/lib/python3.9/dist-packages/telethon/sync.py", line 39, in syncified
    return loop.run_until_complete(coro)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/dist-packages/telethon/client/uploads.py", line 329, in send_file
    entity = await self.get_input_entity(entity)
  File "/usr/local/lib/python3.9/dist-packages/telethon/client/users.py", line 432, in get_input_entity
    await self._get_entity_from_string(peer))
  File "/usr/local/lib/python3.9/dist-packages/telethon/client/users.py", line 569, in _get_entity_from_string
    raise ValueError(
ValueError: Cannot find any entity corresponding to "-10015195XXXXXX"

with channel username : ValueError: No user has "pythonmovies101" as username

with channel invite link :

ValueError: Cannot find any entity corresponding to "t.me/+Y2E9qNtCXXXXXX"
tissole commented 2 years ago

Using chat IDs is not yet implemented, there is a request for this feature. If you really need to use chat ID, try this fork

PiyushDixit96 commented 1 year ago

This is my tested. telegram-upload -d --print-file-id --caption "file_caption" --to "https://t.me/+OozKAsdxxxxxxxxRl" "filename.mp4"

Nekmo commented 1 year ago

Closed due to being a duplicate incident.