From 35424eae1f4a17a0c680f867ca318be381a8b533 Mon Sep 17 00:00:00 2001 From: midoks Date: Fri, 28 Apr 2023 17:21:13 +0800 Subject: [PATCH] up --- .../startup/extend/client_change_username.py | 9 ++++++--- plugins/tgclient/startup/tgclient.py | 16 +++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/plugins/tgclient/startup/extend/client_change_username.py b/plugins/tgclient/startup/extend/client_change_username.py index 6b976cc3e..84b9b91d4 100644 --- a/plugins/tgclient/startup/extend/client_change_username.py +++ b/plugins/tgclient/startup/extend/client_change_username.py @@ -6,6 +6,7 @@ import re import json import base64 import threading +import asyncio sys.path.append(os.getcwd() + "/class/core") import mw @@ -15,9 +16,11 @@ from telebot import types from telebot.util import quick_markup -def run(client): - print(client) - return '' +async def run(client): + while True: + print("123123" + str(time.time())) + await asyncio.sleep(1) + # print(client) if __name__ == "__main__": diff --git a/plugins/tgclient/startup/tgclient.py b/plugins/tgclient/startup/tgclient.py index ec4301289..2edf1a302 100644 --- a/plugins/tgclient/startup/tgclient.py +++ b/plugins/tgclient/startup/tgclient.py @@ -96,22 +96,16 @@ while True: client = TelegramClient('mdioks', cfg['bot']['api_id'], cfg['bot']['api_hash']) -async def change_name_auto(): - while True: - print('will change name') - await asyncio.sleep(1) - - async def plugins_run(): - init_list = getStartExtCfgByTag('client') - for p in init_list: + plist = getStartExtCfgByTag('client') + for p in plist: try: script = p['name'].split('.')[0] - __import__(script).init(client) + await __import__(script).run(client) except Exception as e: - writeLog('-----init error start -------') + writeLog('-----client error start -------') writeLog(mw.getTracebackInfo()) - writeLog('-----init error end -------') + writeLog('-----client error end -------') async def main(loop): await client.start()