3
0

🐛 Fix cannot parse @username

This commit is contained in:
xtaodada 2022-01-28 00:51:01 +08:00
parent 7882e1460f
commit daa43b74fe
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 4 additions and 2 deletions

3
ci.py
View File

@ -1,7 +1,7 @@
from configparser import RawConfigParser
from pyrogram import Client
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from httpx import AsyncClient
from httpx import AsyncClient, get
# 读取配置文件
config = RawConfigParser()
config.read("config.ini")
@ -15,6 +15,7 @@ headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"
}
client = AsyncClient(timeout=10.0, headers=headers)
me = get(f"https://api.telegram.org/bot{bot_token}/getme").json()
# 初始化客户端
scheduler = AsyncIOScheduler()
if not scheduler.running:

View File

@ -6,6 +6,7 @@ from pyrogram import Client, emoji
from pyrogram.types import Message, InlineQuery, CallbackQuery
from pyrogram import filters as Filters
from ci import me
from plugins.enemies import enemies_msg
from plugins.mys2 import mys2_msg, mys2_qun_msg
from plugins.start import welcome_command, ping_command, help_command, leave_command, help_callback
@ -118,7 +119,7 @@ async def process_group_msg(client: Client, message: Message):
text = message.text
msg_list = text.split(' ')
# 帮助消息
if msg_list[0] == '/help':
if msg_list[0] == '/help' or msg_list[0] == f'/help@{me["result"]["username"]}':
await help_command(client, message)
# # 武器查询
if text.startswith('武器查询') or text.startswith('武器资料'):