forked from UsergeTeam/Userge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
genStrSession.py
31 lines (25 loc) · 1.03 KB
/
genStrSession.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
30
31
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
#
# All rights reserved.
import os
import asyncio
from pyrogram import Client
from dotenv import load_dotenv
if os.path.isfile("config.env"):
load_dotenv("config.env")
async def genStrSession() -> None:
async with Client(
"Userge",
api_id=int(os.environ.get("API_ID") or input("Enter Telegram APP ID: ")),
api_hash=os.environ.get("API_HASH") or input("Enter Telegram API HASH: ")
) as userge:
print("\nprocessing...")
await userge.send_message(
"me", f"#USERGE #HU_STRING_SESSION\n\n```{userge.export_session_string()}```")
print("Done !, session string has been sent to saved messages!")
if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(genStrSession())