feat:添加消息记录器

This commit is contained in:
Moyuyanli
2025-03-17 16:02:55 +08:00
parent c095248176
commit 2e4fef6c66
@@ -115,11 +115,8 @@ class SimpleGewechatClient:
abm = AstrBotMessage()
if type_name == "ModContacts":
abm.type = MessageType.OTHER_MESSAGE
abm.raw_message = data
logger.debug(f"abm: {abm}")
return abm
# if type_name == "ModContacts":
# self
from_user_name = d["FromUserName"]["string"] # 消息来源
d["to_wxid"] = from_user_name # 用于发信息
@@ -606,3 +603,19 @@ class SimpleGewechatClient:
json_blob = await resp.json()
logger.debug(f"获取群信息结果: {json_blob}")
return json_blob
async def send_message(self, to_wxid, content):
payload = {
"appId": self.appid,
"toWxid": to_wxid,
"content":content
}
async with aiohttp.ClientSession() as session:
async with session.post(
f"{self.base_url}/message/postText",
headers=self.headers,
json=payload,
) as resp:
json_blob = await resp.json()
logger.debug(f"获取群信息结果: {json_blob}")
# return json_blob