Add: STRINGSESSION use
This commit is contained in:
@@ -139,6 +139,7 @@ esac
|
||||
cat > .env << EOL
|
||||
API_ID=${api_id}
|
||||
API_HASH=${api_hash}
|
||||
STRINGSESSION=
|
||||
# sqlite/sqlite3 or mongo/mongodb
|
||||
DATABASE_TYPE=${db_type}
|
||||
# file name for sqlite3, database name for mongodb
|
||||
|
||||
43
main.py
43
main.py
@@ -35,20 +35,35 @@ script_path = os.path.dirname(os.path.realpath(__file__))
|
||||
if script_path != os.getcwd():
|
||||
os.chdir(script_path)
|
||||
|
||||
app = Client(
|
||||
"my_account",
|
||||
api_id=config.api_id,
|
||||
api_hash=config.api_hash,
|
||||
hide_password=True,
|
||||
workdir=script_path,
|
||||
app_version=userbot_version,
|
||||
device_model=f"Moon-Userbot @ {gitrepo.head.commit.hexsha[:7]}",
|
||||
system_version=platform.version() + " " + platform.machine(),
|
||||
sleep_threshold=30,
|
||||
test_mode=config.test_server,
|
||||
parse_mode=ParseMode.HTML,
|
||||
)
|
||||
|
||||
if not config.STRINGSESSION:
|
||||
app = Client(
|
||||
"my_account",
|
||||
api_id=config.api_id,
|
||||
api_hash=config.api_hash,
|
||||
hide_password=True,
|
||||
workdir=script_path,
|
||||
app_version=userbot_version,
|
||||
device_model=f"Moon-Userbot @ {gitrepo.head.commit.hexsha[:7]}",
|
||||
system_version=platform.version() + " " + platform.machine(),
|
||||
sleep_threshold=30,
|
||||
test_mode=config.test_server,
|
||||
parse_mode=ParseMode.HTML,
|
||||
)
|
||||
elif config.STRINGSESSION:
|
||||
app = Client(
|
||||
"my_account",
|
||||
api_id=config.api_id,
|
||||
api_hash=config.api_hash,
|
||||
session_string=config.STRINGSESSION,
|
||||
hide_password=True,
|
||||
workdir=script_path,
|
||||
app_version=userbot_version,
|
||||
device_model=f"Moon-Userbot @ {gitrepo.head.commit.hexsha[:7]}",
|
||||
system_version=platform.version() + " " + platform.machine(),
|
||||
sleep_threshold=30,
|
||||
test_mode=config.test_server,
|
||||
parse_mode=ParseMode.HTML,
|
||||
)
|
||||
|
||||
async def main():
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
26
string_gen.py
Normal file
26
string_gen.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from pyrogram import Client, enums
|
||||
|
||||
moon_ = """
|
||||
_ ____ ____ _
|
||||
/ \__/|/ _ \/ _ \/ \ /|
|
||||
| |\/||| / \|| / \|| |\ ||
|
||||
| | ||| \_/|| \_/|| | \||
|
||||
\_/ \|\____/\____/\_/ \|
|
||||
|
||||
Copyright (C) 2020-2023 by MoonTg-project@Github, < https://github.com/The-MoonTg-project >.
|
||||
This file is part of < https://github.com/The-MoonTg-project/Moon-Userbot > project,
|
||||
and is released under the "GNU v3.0 License Agreement".
|
||||
Please see < https://github.com/The-MoonTg-project/Moon-Userbot/blob/main/LICENSE >
|
||||
All rights reserved.
|
||||
"""
|
||||
|
||||
print(moon_)
|
||||
|
||||
api_id = input("Enter Your API ID: \n")
|
||||
api_hash = input("Enter Your API HASH : \n")
|
||||
|
||||
with Client("my_account", api_id=api_id, api_hash=api_hash, hide_password=True) as bot_:
|
||||
first_name = (bot_.get_me()).first_name
|
||||
string_session_ = f"<b><u>String Session For {first_name}</b></u> \n<code>{bot_.export_session_string()}</code>"
|
||||
bot_.send_message("me", string_session_, parse_mode=enums.ParseMode.HTML, disable_web_page_preview=True)
|
||||
print(f"String Has Been Sent To Your Saved Message : {first_name}")
|
||||
@@ -116,6 +116,8 @@ cat > .env << EOL
|
||||
API_ID=${api_id}
|
||||
API_HASH=${api_hash}
|
||||
|
||||
STRINGSESSION=
|
||||
|
||||
# sqlite/sqlite3 or mongo/mongodb
|
||||
DATABASE_TYPE=${db_type}
|
||||
# file name for sqlite3, database name for mongodb
|
||||
|
||||
@@ -10,6 +10,8 @@ except FileNotFoundError:
|
||||
api_id = int(os.getenv("API_ID", env.int("API_ID")))
|
||||
api_hash = os.getenv("API_HASH", env.str("API_HASH"))
|
||||
|
||||
STRINGSESSION = os.getenv("STRINGSESSION", env.str("STRINGSESSION"))
|
||||
|
||||
db_type = os.getenv("DATABASE_TYPE", env.str("DATABASE_TYPE"))
|
||||
db_url = os.getenv("DATABASE_URL", env.str("DATABASE_URL", ""))
|
||||
db_name = os.getenv("DATABASE_NAME", env.str("DATABASE_NAME"))
|
||||
|
||||
Reference in New Issue
Block a user