From ff824956296426a5d4cad1d202ee34d0e99dd8b4 Mon Sep 17 00:00:00 2001 From: licproF Date: Sun, 9 Jun 2024 01:55:42 +0800 Subject: [PATCH] Sun Jun 9 01:55:42 AM CST 2024 --- TMBot/__main__.py | 2 +- TMBot/utils/plugins/help.py | 34 ++++++++++++---------------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/TMBot/__main__.py b/TMBot/__main__.py index 3f232e3..b3c2811 100755 --- a/TMBot/__main__.py +++ b/TMBot/__main__.py @@ -7,7 +7,7 @@ import logging logging.basicConfig(level=logging.INFO, - format='%(levelname)s - %(funcName)s - %(message)s') + format='[%(levelname)s] %(funcName)s - %(message)s') def create_dir(path): if not path.exists(): diff --git a/TMBot/utils/plugins/help.py b/TMBot/utils/plugins/help.py index 14a0a5a..f403a63 100755 --- a/TMBot/utils/plugins/help.py +++ b/TMBot/utils/plugins/help.py @@ -1,5 +1,7 @@ import os import json +import aiohttp +import asyncio from pathlib import Path from __main__ import plugConf @@ -18,6 +20,15 @@ def get_prefix(): prefix = get_prefix() longDescription = f'发送 `{prefix}{command} <命令>/<插件名>` 获取插件详细信息。' +async def get_content(url): + async with aiohttp.ClientSession() as session: + async with session.get(url) as response: + if response.status == 200: + content = await response.text() + return content + else: + return '内容获取失败~' + async def handle(event): message = event.message.message cmd = message.split() @@ -40,28 +51,7 @@ async def handle(event): if plugin_info['longDescription']: response += f'说明:{plugin_info['longDescription']}\n' elif name == "TMBot": - response += f'''**关于 TMBot** -https://github.com/licproF/TMBot - -基于 [telethon](https://github.com/LonamiWebs/Telethon) 的 userbot 程序,代码百分百由 ChatGPT 完成。 - -部署:``` -docker run -it \\ - --restart always \\ - --name TMBot \\ - --net host \\ - -v /path/to/TMBdata:/TMBdata \\ - -e api_id=1234567 \\ - -e api_hash=1a2b3c...8x9y0z \\ - noreph/tmbot -``` -插件目录:`TMBdata/plugins`。 -配置文件目录:`TMBdata/config`。 -账号登录数据:`TMBdata/session`。 -api_id、api_hash 请前往 my.telegram.org 申请。 - -__⚠️⚠️⚠️ 温馨提示:谨慎使用,不对使用后出现任何结果负责,包括但不限于封号、被群组管理员禁言、踢出等等__。 -''' + response += await get_content('https://file.pbpz.net/TMBot%20Plugins/README') else: response += f"未找到插件:`{name}`"