-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathssg.py
More file actions
48 lines (42 loc) · 2.31 KB
/
ssg.py
File metadata and controls
48 lines (42 loc) · 2.31 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
print(
"""
Welcome to Session String Generator
╔════╦═══╦╗──╔═══╗╔════╦══╦═══╦═══╗
║╔╗╔╗║╔══╣║──║╔══╝║╔╗╔╗╠╣╠╣╔═╗║╔═╗║
╚╝║║╚╣╚══╣║──║╚══╗╚╝║║╚╝║║║╚═╝║╚══╗
──║║─║╔══╣║─╔╣╔══╝──║║──║║║╔══╩══╗║
──║║─║╚══╣╚═╝║╚══╗──║║─╔╣╠╣║──║╚═╝║
──╚╝─╚═══╩═══╩═══╝──╚╝─╚══╩╝──╚═══╝
Enter 1: Pyrogram Session String
Enter 2: Telethon Session String
"""
)
choice = ""
while (choice != "1" or choice != "2"):
choice = input("Enter 1 or 2: ")
if choice == "1":
print("\nSwitched to Pyrogram\n")
API_ID = int(input("Enter API ID: "))
API_HASH = input("Enter API HASH: ")
print("")
import pyrogram
from pyrogram import enums
with pyrogram.Client("my_account", api_id = API_ID, api_hash = API_HASH, in_memory = True) as ssg_teletips:
ssg_teletips.send_message("me", f"Here is your session string: \n\n<code>{ssg_teletips.export_session_string()}</code> \n\nSession String Generator - @teletipsall", parse_mode=enums.ParseMode.HTML)
print("\nYour session string has been successfully generated!")
print("Please check your Telegram saved messages.")
break
elif choice == "2":
print("\nSwitched to Telethon\n")
API_ID = int(input("Enter API ID: "))
API_HASH = input("Enter API HASH: ")
print("")
from telethon.sync import TelegramClient
from telethon.sessions import StringSession
with TelegramClient(StringSession(), API_ID, API_HASH) as ssg_teletips:
ssg_teletips.send_message("me", f"Here is your session string: \n\n<code>{ssg_teletips.session.save()}</code> \n\nSession String Generator - @teletipsall", parse_mode="html")
print("\nYour session string has been successfully generated!")
print("Please check your Telegram saved messages.")
break
else:
print("\nInvalid input. Try again!\n")