-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathstring_session.py
More file actions
17 lines (14 loc) · 726 Bytes
/
Copy pathstring_session.py
File metadata and controls
17 lines (14 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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""")
API_KEY = input("API_KEY: ")
API_HASH = input("API_HASH: ")
with TelegramClient(StringSession(), API_KEY, API_HASH) as client:
session_string = client.session.save()
saved_messages_template = """<code>STRING_SESSION</code>: <code>{}</code>
️<i>It is forbidden to pass this value to third parties</i>""".format(session_string)
client.send_message("me", saved_messages_template, parse_mode="html")
print("Check Saved Messages on your telegram account !!")