feat:添加消息记录器
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user