feat 微信自动注册菜单

This commit is contained in:
jxxghp 2023-09-05 11:33:42 +08:00
parent 551f32491d
commit b564f70c63
3 changed files with 8 additions and 8 deletions

View File

@ -109,13 +109,12 @@ class Command(metaclass=Singleton):
"/downloading": { "/downloading": {
"func": DownloadChain(self._db).remote_downloading, "func": DownloadChain(self._db).remote_downloading,
"description": "正在下载", "description": "正在下载",
"category": "下载",
"data": {} "data": {}
}, },
"/transfer": { "/transfer": {
"func": TransferChain(self._db).process, "func": TransferChain(self._db).process,
"description": "下载文件整理", "description": "下载文件整理",
"category": "下载", "category": "管理",
"data": {} "data": {}
}, },
"/redo": { "/redo": {

View File

@ -96,11 +96,12 @@ class WechatModule(_ModuleBase):
# 解析消息内容 # 解析消息内容
if msg_type == "event" and event == "click": if msg_type == "event" and event == "click":
# 校验用户有权限执行交互命令 # 校验用户有权限执行交互命令
wechat_admins = settings.WECHAT_ADMINS.split(',') if settings.WECHAT_ADMINS:
if wechat_admins and not any( wechat_admins = settings.WECHAT_ADMINS.split(',')
user_id == admin_user for admin_user in wechat_admins): if wechat_admins and not any(
self.wechat.send_msg(title="用户无权限执行菜单命令", userid=user_id) user_id == admin_user for admin_user in wechat_admins):
return None self.wechat.send_msg(title="用户无权限执行菜单命令", userid=user_id)
return None
# 根据Event执行命令 # 根据Event执行命令
content = event content = event
logger.info(f"收到微信事件userid={user_id}, event={content}") logger.info(f"收到微信事件userid={user_id}, event={content}")

View File

@ -286,7 +286,7 @@ class WeChat(metaclass=Singleton):
"data": {} "data": {}
} }
} }
注册报文格式子菜单最多只有5条 注册报文格式一级菜单只有最多3条子菜单最多只有5条
{ {
"button":[ "button":[
{ {