Skip to content

Commit

Permalink
Sun Jun 9 01:55:42 AM CST 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
licproF committed Jun 8, 2024
1 parent 6add62c commit ff82495
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
2 changes: 1 addition & 1 deletion TMBot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
34 changes: 12 additions & 22 deletions TMBot/utils/plugins/help.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import json
import aiohttp
import asyncio
from pathlib import Path
from __main__ import plugConf

Expand All @@ -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()
Expand All @@ -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}`"

Expand Down

0 comments on commit ff82495

Please sign in to comment.