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

Upload to Channel or Group #62

Closed silente closed 4 years ago

silente commented 4 years ago

Description

Its possiblle to Upload to private channl or group ?

Nekmo commented 4 years ago

@silente yes. If you have problems let us know.

silente commented 4 years ago

I try to use the channel id

telegram-upload --no-thumbnail --forward [CHANNELID] --caption "" [FILES]

Traceback (most recent call last):
  File "/usr/local/bin/telegram-upload", line 8, in <module>
    sys.exit(upload_cli())
  File "/usr/local/lib/python3.7/dist-packages/telegram_upload/exceptions.py", line 46, in wrap
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/telegram_upload/management.py", line 45, in upload
    client.send_files(to, files, delete_on_success, print_file_id, force_file, forward, caption, no_thumbnail)
  File "/usr/local/lib/python3.7/dist-packages/telegram_upload/client.py", line 99, in send_files
    self.forward_to(message, forward)
  File "/usr/local/lib/python3.7/dist-packages/telegram_upload/client.py", line 130, in forward_to
    self.forward_messages(destination, [message])
  File "/usr/local/lib/python3.7/dist-packages/telethon/sync.py", line 36, in syncified
    return loop.run_until_complete(coro)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.7/dist-packages/telethon/client/messages.py", line 688, in forward_messages
    entity = await self.get_input_entity(entity)
  File "/usr/local/lib/python3.7/dist-packages/telethon/client/users.py", line 342, in get_input_entity
    await self._get_entity_from_string(peer))
  File "/usr/local/lib/python3.7/dist-packages/telethon/client/users.py", line 471, in _get_entity_from_string
    'Cannot find any entity corresponding to "{}"'.format(string)
ValueError: Cannot find any entity corresponding to "[CHANNELID]"

I have insert only channel ID, without -100 as prefix I think i cant use channel name because its private. Correct? Obviously i am administrator of the group

Nekmo commented 4 years ago

@silente try using the private invite link. For example: https://t.me/joinchat/AAAAAFFszQPyPEZ7wgxLtd

Nekmo commented 4 years ago

@silente try using the private invite link. For example: https://t.me/joinchat/AAAAAFFszQPyPEZ7wgxLtd

I have tried an invite link and it works fine.

$ telegram-upload /home/nekmo/amazon-dash.png --to 'https://t.me/joinchat/Dz03NhnHJ60HoRxD1lBmlw'