chore(userbot): apply ruff check --fix and ruff format
- ruff check --fix: 210 auto-fixed errors (import sorting, trailing whitespace, unused imports, f-string fixups, deprecated annotations) - ruff format: 104 files reformatted to consistent style - 268 non-auto-fixable issues remain (S113 requests timeout, etc.)
This commit is contained in:
+24
-24
@@ -1,23 +1,23 @@
|
||||
from datetime import datetime
|
||||
import sys
|
||||
from pyrogram import Client
|
||||
from datetime import datetime
|
||||
|
||||
from pyrogram import Client
|
||||
from utils import config
|
||||
|
||||
common_params = {
|
||||
"api_id": config.api_id,
|
||||
"api_hash": config.api_hash,
|
||||
"hide_password": True,
|
||||
"test_mode": config.test_server,
|
||||
'api_id': config.api_id,
|
||||
'api_hash': config.api_hash,
|
||||
'hide_password': True,
|
||||
'test_mode': config.test_server,
|
||||
}
|
||||
|
||||
if __name__ == "__main__":
|
||||
if __name__ == '__main__':
|
||||
if config.STRINGSESSION:
|
||||
common_params["session_string"] = config.STRINGSESSION
|
||||
common_params['session_string'] = config.STRINGSESSION
|
||||
|
||||
app = Client("my_account", **common_params)
|
||||
app = Client('my_account', **common_params)
|
||||
|
||||
if config.db_type in ["mongo", "mongodb"]:
|
||||
if config.db_type in ['mongo', 'mongodb']:
|
||||
from pymongo import MongoClient, errors
|
||||
|
||||
db = MongoClient(config.db_url)
|
||||
@@ -26,27 +26,27 @@ if __name__ == "__main__":
|
||||
except errors.ConnectionFailure as e:
|
||||
raise RuntimeError(
|
||||
"MongoDB server isn't available! "
|
||||
f"Provided url: {config.db_url}. "
|
||||
"Enter valid URL and restart installation"
|
||||
f'Provided url: {config.db_url}. '
|
||||
'Enter valid URL and restart installation'
|
||||
) from e
|
||||
|
||||
install_type = sys.argv[1] if len(sys.argv) > 1 else "3"
|
||||
if install_type == "1":
|
||||
restart = "pm2 restart Moon"
|
||||
elif install_type == "2":
|
||||
restart = "sudo systemctl restart Moon"
|
||||
install_type = sys.argv[1] if len(sys.argv) > 1 else '3'
|
||||
if install_type == '1':
|
||||
restart = 'pm2 restart Moon'
|
||||
elif install_type == '2':
|
||||
restart = 'sudo systemctl restart Moon'
|
||||
else:
|
||||
restart = "cd Moon-Userbot/ && python main.py"
|
||||
restart = 'cd Moon-Userbot/ && python main.py'
|
||||
|
||||
app.start()
|
||||
try:
|
||||
app.send_message(
|
||||
"me",
|
||||
f"<b>[{datetime.now()}] Userbot launched! \n"
|
||||
"Custom modules: @moonub_modules\n"
|
||||
f"For restart, enter:</b>\n"
|
||||
f"<code>{restart}</code>",
|
||||
'me',
|
||||
f'<b>[{datetime.now()}] Userbot launched! \n'
|
||||
'Custom modules: @moonub_modules\n'
|
||||
f'For restart, enter:</b>\n'
|
||||
f'<code>{restart}</code>',
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"[ERROR]: Sending Message to me failed! {e}")
|
||||
print(f'[ERROR]: Sending Message to me failed! {e}')
|
||||
app.stop()
|
||||
|
||||
Reference in New Issue
Block a user