fix:提升VoceChat安全性

This commit is contained in:
jxxghp
2024-03-07 17:07:28 +08:00
parent 9476017af5
commit 2b570bf48f
2 changed files with 6 additions and 1 deletions

View File

@ -67,6 +67,11 @@ class VoceChatModule(_ModuleBase):
# 非新消息
return None
logger.debug(f"收到VoceChat请求{msg_body}")
# token校验
token = args.get("token")
if not token or token != settings.API_TOKEN:
logger.warn(f"VoceChat请求token校验失败{token}")
return None
# 文本内容
content = msg_body.get("detail", {}).get("content")
# 用户ID