aahnik / tgcf

The ultimate tool to automate custom telegram message forwarding. Live-syncer, Auto-poster, backup-bot, cloner, chat-forwarder, duplicator, ... Call it whatever you like! tgcf can fulfill your custom needs.
https://github.com/aahnik/tgcf/wiki
MIT License
1.31k stars 783 forks source link

Not possible to forward files from private channels where forwarding is restricted #363

Closed jamregistr closed 1 year ago

jamregistr commented 1 year ago

Describe the bug Bot work perfect for text messages, but it's not possible to forward messages with files from private channel where forwarding is restricted. Log file output:

                    ERROR    Unhandled exception on               updates.py:499
                             new_message_handler                                
                             ╭─ Traceback (most recent call las─╮               
                             │ /venv/lib/python3.10/site-packag │               
                             │ es/telethon/client/updates.py:48 │               
                             │ 3 in _dispatch_update            │               
                             │                                  │               
                             │   480 │   │   │   │   continue   │               
                             │   481 │   │   │                  │               
                             │   482 │   │   │   try:           │               
                             │ ❱ 483 │   │   │   │   await call │               
                             │   484 │   │   │   except errors. │               
                             │   485 │   │   │   │   name = get │               
                             │   486 │   │   │   │   self._log[ │               
                             │                                  │               
                             │ /venv/lib/python3.10/site-packag │               
                             │ es/tgcf/live.py:53 in            │               
                             │ new_message_handler              │               
                             │                                  │               
                             │    50 │   for d in dest:         │               
                             │    51 │   │   if event.is_reply  │               
                             │    52 │   │   │   tm.reply_to =  │               
                             │ ❱  53 │   │   fwded_msg = await  │               
                             │    54 │   │   st.stored[event_ui │               
                             │    55 │   tm.clear()             │               
                             │    56                            │               
                             │                                  │               
                             │ /venv/lib/python3.10/site-packag │               
                             │ es/tgcf/utils.py:30 in           │               
                             │ send_message                     │               
                             │                                  │               
                             │   27 │   │   )                   │               
                             │   28 │   │   return message      │               
                             │   29 │   tm.message.text = tm.te │               
                             │ ❱ 30 │   return await client.sen │               
                             │   31                             │               
                             │   32                             │               
                             │   33 def cleanup(*files: str) -> │               
                             │                                  │               
                             │ /venv/lib/python3.10/site-packag │               
                             │ es/telethon/client/messages.py:8 │               
                             │ 38 in send_message               │               
                             │                                  │               
                             │    835 │   │   │                 │               
                             │    836 │   │   │   if (message.m │               
                             │    837 │   │   │   │   │   messa │               
                             │ ❱  838 │   │   │   │   return aw │               
                             │    839 │   │   │   │   │   entit │               
                             │    840 │   │   │   │   │   messa │               
                             │    841 │   │   │   │   │   capti │               
                             │                                  │               
                             │ /venv/lib/python3.10/site-packag │               
                             │ es/telethon/client/uploads.py:41 │               
                             │ 2 in send_file                   │               
                             │                                  │               
                             │   409 │   │   │   schedule_date= │               
                             │   410 │   │   │   background=bac │               
                             │   411 │   │   )                  │               
                             │ ❱ 412 │   │   return self._get_r │               
                             │   413 │                          │               
                             │   414 │   async def _send_album( │               
                             │   415 │   │   │   │   │   │      │               
                             │                                  │               
                             │ /venv/lib/python3.10/site-packag │               
                             │ es/telethon/client/users.py:30   │               
                             │ in __call__                      │               
                             │                                  │               
                             │    27                            │               
                             │    28 class UserMethods:         │               
                             │    29 │   async def __call__(sel │               
                             │       flood_sleep_threshold=None │               
                             │ ❱  30 │   │   return await self. │               
                             │    31 │                          │               
                             │    32 │   async def _call(self:  │               
                             │       flood_sleep_threshold=None │               
                             │    33 │   │   if flood_sleep_thr │               
                             │                                  │               
                             │ /venv/lib/python3.10/site-packag │               
                             │ es/telethon/client/users.py:84   │               
                             │ in _call                         │               
                             │                                  │               
                             │    81 │   │   │   │   │   else:  │               
                             │    82 │   │   │   │   │   │   re │               
                             │    83 │   │   │   │   else:      │               
                             │ ❱  84 │   │   │   │   │   result │               
                             │    85 │   │   │   │   │   self.s │               
                             │    86 │   │   │   │   │   self._ │               
                             │    87 │   │   │   │   │   return │               
                             ╰──────────────────────────────────╯               
                             ChatForwardsRestrictedError:                       
                             (caused by SendMediaRequest)

System information: Linux Ubuntu -> Docker container

aahnik commented 1 year ago

@jamregistr when forwarding is restricted, telegram does not allow you to forward. sorry, nothing can be done in this regard.

Elovel commented 1 year ago

its just working with MadelineProto