This will print out python code that you can use to use the same session in telethon.
It will also print a telethon session string which you can use instead.
| import { StringSession } from "telegram/sessions"; | |
| (async () => { | |
| const stringSession = new StringSession("your gramjs session here (node only)"); | |
| await stringSession.load(); | |
| console.log(` | |
| from telethon.sync import TelegramClient | |
| from telethon.crypto import AuthKey | |
| from telethon.sessions import StringSession | |
| my_session = StringSession("") | |
| my_session.set_dc(${stringSession.dcId},"${stringSession.serverAddress}",${stringSession.port}) | |
| my_session.auth_key = AuthKey(bytes.fromhex("${stringSession.authKey.getKey().toString("hex")}")) | |
| client = TelegramClient(my_session, 1, "1") | |
| client.start() | |
| print(client.session.save()) | |
| print("me is",client.get_me()) | |
| `); | |
| })(); | |