Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bot token as environment variable #30

Closed
shahram7 opened this issue Nov 25, 2023 · 5 comments · Fixed by #31
Closed

bot token as environment variable #30

shahram7 opened this issue Nov 25, 2023 · 5 comments · Fixed by #31
Assignees
Labels
enhancement New feature or request

Comments

@shahram7
Copy link

Hi Nyaran,

I start the container with the command "docker compose run --rm telegram-download-daemon", then I enter the token ID of my bot, which is admin in my channel, then I copy the DownloadDaemon.session in session folder from my stack into portainer and start the stack. the logs of telegram-download-daemon looks like this right now:

[WARNING/2023-11-25 18:27:45,843]telethon.network.connection.connection:Server closed the connection: 0 bytes read on a total of 8 expected bytes
[WARNING/2023-11-25 18:27:46,162]telethon.network.mtprotostate:Server sent a very new message with ID 730546839975292033, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,163]telethon.network.mtprotostate:Server sent a very new message with ID 730546839977496065, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,163]telethon.network.mtprotostate:Server sent a very new message with ID 730546839978068065, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,163]telethon.network.mtprotostate:Server sent a very new message with ID 730546839978272417, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,163]telethon.network.mtprotostate:Server sent a very new message with ID 730546839978586721, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,164]telethon.network.mtprotostate:Server sent a very new message with ID 730546839978841921, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,164]telethon.network.mtprotostate:Server sent a very new message with ID 730546839978892097, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,164]telethon.network.mtprotostate:Server sent a very new message with ID 730546839979275873, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,164]telethon.network.mtprotostate:Server sent a very new message with ID 730546839979609377, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,164]telethon.network.mtprotostate:Server sent a very new message with ID 730546839979858001, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,164]telethon.network.mtprotosender:Security error while unpacking a received message: Too many messages had to be ignored consecutively
[WARNING/2023-11-25 18:27:46,165]telethon.network.mtprotostate:Server sent a very new message with ID 7305468399804417025, ignoring (see FAQ for details)
[WARNING/2023-11-25 18:27:46,165]telethon.network.mtprotosender:Security error while unpacking a received message: Too many messages had to be ignored consecutively

I noticed that if you enter the BOT token instead of your phone number, you don't have to enter any code. (so there is no interaction necessary) Is it possible to pass the "bot token" as an environment variable to skip this interactive part? so the authentication is going to be done on every restart!

Best regards,
Shahram

@shahram7 shahram7 changed the title bot token as environment variablen bot token as environment variable Nov 25, 2023
@Nyaran Nyaran added the enhancement New feature or request label Nov 28, 2023
@Nyaran
Copy link
Owner

Nyaran commented Nov 28, 2023

Hi

I don't know how to reproduce that error. You mention docker-compose, but I removed the file few weeks ago, as now you can this directly from DockerHub (i.e nyaran/telegram-download-daemon-ng). Anyway, if you keep getting that error, please create a separate issue.

About the request to add an environment variable to use the bot id, is a good idea, I will work on it.

@Nyaran
Copy link
Owner

Nyaran commented Nov 28, 2023

You can use the docker tag 1.0.0-beta.6 to try this.

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

@shahram7
Copy link
Author

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'

@shahram7
Copy link
Author

Hi Luis, can you help me with this error?
Error: 'Message' object has no attribute 'destination'

@Nyaran
Copy link
Owner

Nyaran commented Nov 30, 2023

Moved to #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants