callsmusic / tgvc-userbot

Telegram voice chat userbot made with Pyrogram and MarshalX/tgcalls with playlist support
https://t.me/VCSets
GNU Affero General Public License v3.0
161 stars 335 forks source link

How to get SESSION_NAME (session string) for Heroku deployment? #1

Closed Thakshaka closed 3 years ago

dashezup commented 3 years ago

When you deploy it to Heroku, you see this

SESSION_NAME Required Session string, read the README to learn how to export it with Pyrogram

The README

  • Session string can be exported by using Pyrogram

    # pip install Pyrogram TgCrypto
    from pyrogram import Client
    
    api_id = 1234567
    api_hash = "0123456789abcdef0123456789abcdef"
    
    with Client(":memory:", api_id, api_hash) as app, open("session.txt", "w+") as s_file:
     session_string = app.export_session_string()
     s_file.write(session_string)
     print("Session string has been saved to session.txt")
     print(session_string)

api_id and api_hash should be get from https://my.telegram.org/apps as mentioned on Heroku deployment page or the README

Alternatively you can use replit to run codes to get the session string, but use it at your own risk, here is one if you want to try https://repl.it/@Leorio/stringsessiongen#main.py

Session string is very sensitive data, people who have your session string could login your account and can do anything to your Telegram account. Be sure to keep it private and safe.


Session string is only for people who deploy it on Heroku, you don't need it if you run this userbot on your cloud server or VPS because the session is saved as session_name.session file.