generated from dkputra/oub-remix
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
string_session.py
27 lines (22 loc) · 1.08 KB
/
string_session.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3
# (c) https://t.me/TelethonChat/37677 and SpEcHiDe
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
from telethon.sync import TelegramClient
from telethon.sessions import StringSession
print("""Please go-to my.telegram.org
Login using your Telegram account
Click on API Development Tools
Create a new application, by entering the required details
Check your Telegram saved messages section to copy the STRING_SESSION""")
API_KEY = int(input("Enter API_KEY here: "))
API_HASH = input("Enter API_HASH here: ")
with TelegramClient(StringSession(), API_KEY, API_HASH) as client:
print("Check your Telegram Saved Messages to copy the STRING_SESSION value")
session_string = client.session.save()
saved_messages_template = """Support: @remixsupport
<code>STRING_SESSION</code>: <code>{}</code>
⚠️ <i>Please be careful before passing this value to third parties</i>""".format(session_string)
client.send_message("me", saved_messages_template, parse_mode="html")