forked from xditya/TeleBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
telesetup.py
29 lines (25 loc) · 1.03 KB
/
telesetup.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
28
29
#!/usr/bin/env python3
# (c) https://t.me/TelethonChat/37677
# This Source Code Form is subject to the terms of the GNU
# General Public License, v.3.0. If a copy of the GPL was not distributed with this
# file, You can obtain one at https://www.gnu.org/licenses/gpl-3.0.en.html.
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
For TeleBot""")
print("")
APP_ID = int(input("Enter APP ID here: "))
API_HASH = input("Enter API HASH here: ")
with TelegramClient(StringSession(), APP_ID, API_HASH) as client:
tele = client.send_message("me", client.session.save())
tele.reply(
"The above is the `STRING_SESSION` for your current session.\n@TeleBotSupport")
print("")
print("")
print("Below is the STRING_SESSION. You can also find it in your Telegram Saved Messages.")
print("")
print("")
print(client.session.save())