Nyaran / telegram-download-daemon-ng

A simple script to automate telegram download of big files
GNU General Public License v3.0
2 stars 0 forks source link

Error: 'Message' object has no attribute 'destination' #32

Open Nyaran opened 9 months ago

Nyaran commented 9 months ago

Originally posted by @shahram7 in https://github.com/Nyaran/telegram-download-daemon-ng/issues/30#issuecomment-1831573759

Hi Luis, i have used this compose file here:

version: '3.5'

services:
  gluetun:
    image: qmcgaw/gluetun
    cap_add:
      - NET_ADMIN
    environment:
      - VPN_SERVICE_PROVIDER=nordvpn
      - OPENVPN_USER=xxxxxxxxxxxxxxxxxx
      - OPENVPN_PASSWORD=xxxxxxxxxxxxxxxxxxxxx
      - SERVER_REGIONS=Netherlands
    restart: unless-stopped
  tdd:
#    image: alfem/telegram-download-daemon:latest
#    image: nyaran/telegram-download-daemon-ng:main
    image: nyaran/telegram-download-daemon-ng:1.0.0-beta.6
    container_name: telegram-download
    network_mode: service:gluetun
    depends_on:
      - gluetun
    read_only: true
    environment:
      - TELEGRAM_DAEMON_API_ID=xxxxxxxxxxxxxxx
      - TELEGRAM_DAEMON_API_HASH=xxxxxxxxxxxx
      - TELEGRAM_DAEMON_CHANNEL=-xxxxxxxxxxxxx
      - TELEGRAM_DAEMON_DEST=/downloads
      - TELEGRAM_DAEMON_SESSION_PATH=/session
      - TELEGRAM_DAEMON_DUPLICATES=rename
      - TELEGRAM_DAEMON_BOT=xxxxxxxxxxxxxxx
#      - TELEGRAM_DAEMON_WORKERS=4
    volumes:
      - downloads:/downloads
      - sessions:/session
    restart: unless-stopped
    labels:
      - io.portainer.accesscontrol.public
    logging:
      options:
        max-size: 1m
volumes:
    sessions:
    downloads:

thank you very Much for your time and effort. it seems that it works. in the logs i can see just this line

WARNING/2023-11-29 09:51:14,578]telethon.network.mtprotosender:Attempt 1 at connecting failed: TimeoutError:

but when i send a file to my channel i get this message: Error: 'Message' object has no attribute 'destination'

Nyaran commented 9 months ago

@shahram7 what method are you using to send file to the channel? message link? group link? resend? I tried all methods, and I'm unable to reproduce that error. Can you provide me a step-by-step list to help you to solve the issue? The telegram channel where you are downloading from could be helpful (if is not a private channel, of course)

shahram7 commented 9 months ago

HI Luis, I've always tested the daemon with sending a picture from gallery. I use a private channel for the downloader daemon. Screen_Recording_20231201_092946_Telegram.zip

Nyaran commented 9 months ago

Oh, I see...

Working on it, thanks for the report!

Nyaran commented 9 months ago

Please try with 1.0.0-beta.7

docker pull nyaran/telegram-download-daemon-ng:1.0.0-beta.7
shahram7 commented 9 months ago

Please try with 1.0.0-beta.7

docker pull nyaran/telegram-download-daemon-ng:1.0.0-beta.7

it works but i managed to download just jpeg files so far! after sending larger files to the channel nothing is happend!

Received:  NewMessage.Event(original_update=UpdateNewChannelMessage(message=Message(id=1233, peer_id=PeerChannel(channel_id=1000000002), date=datetime.datetime(2023, 12, 2, 11, 54, 26, tzinfo=datetime.timezone.utc), message='queue', out=False, mentioned=False, media_unread=False, silent=True, post=True, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, invert_media=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=1, forwards=0, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None), pts=10829, pts_count=1), pattern_match=None, message=Message(id=1233, peer_id=PeerChannel(channel_id=1000000002), date=datetime.datetime(2023, 12, 2, 11, 54, 26, tzinfo=datetime.timezone.utc), message='queue', out=False, mentioned=False, media_unread=False, silent=True, post=True, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, invert_media=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=1, forwards=0, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None))
Send message link to download or use available commands: list, status, clean.
Received:  NewMessage.Event(original_update=UpdateNewChannelMessage(message=Message(id=1234, peer_id=PeerChannel(channel_id=1000000002), date=datetime.datetime(2023, 12, 2, 11, 54, 43, tzinfo=datetime.timezone.utc), message='status', out=False, mentioned=False, media_unread=False, silent=True, post=True, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, invert_media=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=1, forwards=0, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None), pts=10831, pts_count=1), pattern_match=None, message=Message(id=1234, peer_id=PeerChannel(channel_id=1000000002), date=datetime.datetime(2023, 12, 2, 11, 54, 43, tzinfo=datetime.timezone.utc), message='status', out=False, mentioned=False, media_unread=False, silent=True, post=True, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, invert_media=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=1, forwards=0, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None))
No active downloads

d:  NewMessage.Event(original_update=UpdateNewChannelMessage(message=Message(id=1235, peer_id=PeerChannel(channel_id=1000000002), date=datetime.datetime(2023, 12, 2, 11, 55, 11, tzinfo=datetime.timezone.utc), message='', out=False, mentioned=False, media_unread=False, silent=True, post=True, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, invert_media=False, from_id=None, fwd_from=MessageFwdHeader(date=datetime.datetime(2023, 12, 2, 10, 9, 47, tzinfo=datetime.timezone.utc), imported=False, from_id=None, from_name='Max Mustermann', channel_post=None, post_author=None, saved_from_peer=None, saved_from_msg_id=None, psa_type=None), via_bot_id=None, reply_to=None, media=MessageMediaDocument(nopremium=False, spoiler=False, document=Document(id=6000000000000000004, access_hash=-7000000000000000006, file_reference=b'\x02r$,\xd0\x00\x00\x04\xd3ek\x1b\x1f\\Ko\xd5\x05\xdb+\xb0\xe1\xbbd\x96\xe7\x95\x11\xca', date=datetime.datetime(2023, 12, 2, 10, 8, 13, tzinfo=datetime.timezone.utc), mime_type='video/mp4', size=300783035, dc_id=4, attributes=[DocumentAttributeFilename(file_name='20231201_215422.mp4')], thumbs=[], video_thumbs=[]), alt_document=None, ttl_seconds=None), reply_markup=None, entities=[], views=1, forwards=0, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None), pts=10832, pts_count=1), pattern_match=None, message=Message(id=1235, peer_id=PeerChannel(channel_id=1000000002), date=datetime.datetime(2023, 12, 2, 11, 55, 11, tzinfo=datetime.timezone.utc), message='', out=False, mentioned=False, media_unread=False, silent=True, post=True, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, invert_media=False, from_id=None, fwd_from=MessageFwdHeader(date=datetime.datetime(2023, 12, 2, 10, 9, 47, tzinfo=datetime.timezone.utc), imported=False, from_id=None, from_name='Max Mustermann', channel_post=None, post_author=None, saved_from_peer=None, saved_from_msg_id=None, psa_type=None), via_bot_id=None, reply_to=None, media=MessageMediaDocument(nopremium=False, spoiler=False, document=Document(id=6000000000000000004, access_hash=-7161437800881781016, file_reference=b'\x02r$,\xd0\x00\x00\x04\xd3ek\x1b\x1f\\Ko\xd5\x05\xdb+\xb0\xe1\xbbd\x96\xe7\x95\x11\xca', date=datetime.datetime(2023, 12, 2, 10, 8, 13, tzinfo=datetime.timezone.utc), mime_type='video/mp4', size=300783035, dc_id=4, attributes=[DocumentAttributeFilename(file_name='20231201_215422.mp4')], thumbs=[], video_thumbs=[]), alt_document=None, ttl_seconds=None), reply_markup=None, entities=[], views=1, forwards=0, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None))
Events handler error:  'NoneType' object has no attribute 'id'
Nyaran commented 9 months ago

Sorry, but unable to reproduce, I send many kind of files (mp4, mkv, iso, zip) with different size (6MB, 360MB, 450MB, 600MB and 1,5GB), and the videos tried as normal file and as media file and everything works

The file is uploaded to Telegram properly? Remember that first it will be uploaded to Telegram servers before the message is ready to be read by the bot.

If you can provide more info about the kind of file you are using, I could be able to reproduce the error

shahram7 commented 9 months ago

Sorry, but unable to reproduce, I send many kind of files (mp4, mkv, iso, zip) with different size (6MB, 360MB, 450MB, 600MB and 1,5GB), and the videos tried as normal file and as media file and everything works

The file is uploaded to Telegram properly? Remember that first it will be uploaded to Telegram servers before the message is ready to be read by the bot.

If you can provide more info about the kind of file you are using, I could be able to reproduce the error

  • Type
  • Size
  • Name (replace sensitive information)

I have currently problems with my VPN container as well and I am not able to test the daemon downloader properly. Thank you very much for your time and effort.

shahram7 commented 9 months ago

Hi Luis, I'm back again. I had to rebuild a VM for my Docker Engine and so on. I see this message a lot in my log, is it ok?

[WARNING/2023-12-20 08:56:22,742]telethon.network.connection.connection:Server closed the connection: 0 bytes read on a total of 8 expected bytes
[WARNING/2023-12-20 08:58:22,814]telethon.network.connection.connection:Server closed the connection: 0 bytes read on a total of 8 expected bytes
[WARNING/2023-12-20 08:59:22,881]telethon.network.connection.connection:Server closed the connection: 0 bytes read on a total of 8 expected bytes

and when i forward a file lets say a movie or a book from a Bot to my downloader channel i see following in my log:

  File "/usr/src/telegram-download-daemon-ng/src/telegram_download_daemon_ng/__init__.py", line 132, in handler
    channel=channel_msg.chat.id,

but if I send a file from my phone, like a picture, it works.

I think it's another problem. Should I create a new Issue? Best regards, Shahram

Nyaran commented 8 months ago

Hi! Sorry for my late response.

About the first messages, is about Telegram closing the connection, I'll try to check if we are making too many connections, anyway, is a warning message, so, if you are not having problems, you can ignore it.

About the second message, that is just the stacktrace, pointing the place in code when the error occurs, but not the error itself, There are line around that could be related, can you paste that lines too?

Lastly, to understand better your use case. You are in a channel, where a bot sends files, and you want to download that files? Be sure that you, or the account or bot you are setting up for the daemon, are joined to the group