Merge pull request #48 from lich0821/3.9.2.23

Update
This commit is contained in:
Changhua authored and GitHub committed 2023-07-12 23:24:34 +08:00
commit a37b7ce5ae
5 files changed
+14 -12

No files matched your search

+1 -1
View File
@@ -1 +1 @@
{"openapi":"3.0.2","info":{"title":"WeChatFerry HTTP 客户端","description":"Github: <a href='https://github.com/lich0821/WeChatFerry'>WeChatFerry</a>","version":"0.1.0"},"paths":{"/msg_cb":{"post":{"tags":["示例"],"summary":"接收消息回调样例","description":"示例回调方法,简单打印消息","operationId":"msg_cb_msg_cb_post","requestBody":{"content":{"application/json":{"schema":{"title":"Msg","allOf":[{"$ref":"#/components/schemas/Msg"}],"description":"微信消息"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/login":{"get":{"summary":"获取登录状态","description":"获取登录状态","operationId":"is_login_login_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Is Login Login Get","type":"object"}}}}}}},"/wxid":{"get":{"summary":"获取登录账号 wxid","description":"获取登录账号 wxid","operationId":"get_self_wxid_wxid_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Self Wxid Wxid Get","type":"object"}}}}}}},"/user-info":{"get":{"summary":"获取登录账号个人信息","description":"获取登录账号个人信息","operationId":"get_user_info_user_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get User Info User Info Get","type":"object"}}}}}}},"/msg-types":{"get":{"summary":"获取消息类型","description":"获取消息类型","operationId":"get_msg_types_msg_types_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Msg Types Msg Types Get","type":"object"}}}}}}},"/contacts":{"get":{"summary":"获取完整通讯录","description":"获取完整通讯录","operationId":"get_contacts_contacts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Contacts Contacts Get","type":"object"}}}}}}},"/friends":{"get":{"summary":"获取好友列表","description":"获取好友列表","operationId":"get_friends_friends_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Friends Friends Get","type":"object"}}}}}}},"/dbs":{"get":{"summary":"获取所有数据库","description":"获取所有数据库","operationId":"get_dbs_dbs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Dbs Dbs Get","type":"object"}}}}}}},"/{db}/tables":{"get":{"summary":"获取 db 中所有表","description":"获取 db 中所有表\n\nArgs:\n db (str): 数据库名(可通过 `get_dbs` 查询)\n\nReturns:\n List[dict]: `db` 下的所有表名及对应建表语句","operationId":"get_tables__db__tables_get","parameters":[{"required":true,"schema":{"title":"Db","type":"string"},"name":"db","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Tables Db Tables Get","type":"object"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/text":{"post":{"summary":"发送文本消息","description":"发送文本消息,可参考:https://github.com/lich0821/WeChatRobot/blob/master/robot.py 里 sendTextMsg\n\nArgs:\n msg (str): 要发送的消息,换行使用 `\\n`;如果 @ 人的话,需要带上跟 `aters` 里数量相同的 @\n receiver (str): 消息接收人,wxid 或者 roomid\n aters (str): 要 @ 的 wxid,多个用逗号分隔;`@所有人` 只需要 `nofity@all`\n\nReturns:\n int: 0 为成功,其他失败","operationId":"send_text_text_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_send_text_text_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Send Text Text Post","type":"object"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/image":{"post":{"summary":"发送图片消息","description":"发送图片,非线程安全\n\nArgs:\n path (str): 图片路径,如:`C:/Projs/WeChatRobot/TEQuant.jpeg` 或 `https://raw.githubusercontent.com/lich0821/WeChatRobot/master/TEQuant.jpeg`\n receiver (str): 消息接收人,wxid 或者 roomid\n\nReturns:\n int: 0 为成功,其他失败","operationId":"send_image_image_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_send_image_image_post"}}}},"responses":{"200":{"desLine truncated
{"openapi":"3.0.2","info":{"title":"WeChatFerry HTTP 客户端","description":"Github: <a href='https://github.com/lich0821/WeChatFerry'>WeChatFerry</a>","version":"0.1.0"},"paths":{"/msg_cb":{"post":{"tags":["示例"],"summary":"接收消息回调样例","description":"示例回调方法,简单打印消息","operationId":"msg_cb_msg_cb_post","requestBody":{"content":{"application/json":{"schema":{"title":"Msg","allOf":[{"$ref":"#/components/schemas/Msg"}],"description":"微信消息"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/login":{"get":{"summary":"获取登录状态","description":"获取登录状态","operationId":"is_login_login_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Is Login Login Get","type":"object"}}}}}}},"/wxid":{"get":{"summary":"获取登录账号 wxid","description":"获取登录账号 wxid","operationId":"get_self_wxid_wxid_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Self Wxid Wxid Get","type":"object"}}}}}}},"/user-info":{"get":{"summary":"获取登录账号个人信息","description":"获取登录账号个人信息","operationId":"get_user_info_user_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get User Info User Info Get","type":"object"}}}}}}},"/msg-types":{"get":{"summary":"获取消息类型","description":"获取消息类型","operationId":"get_msg_types_msg_types_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Msg Types Msg Types Get","type":"object"}}}}}}},"/contacts":{"get":{"summary":"获取完整通讯录","description":"获取完整通讯录","operationId":"get_contacts_contacts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Contacts Contacts Get","type":"object"}}}}}}},"/friends":{"get":{"summary":"获取好友列表","description":"获取好友列表","operationId":"get_friends_friends_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Friends Friends Get","type":"object"}}}}}}},"/dbs":{"get":{"summary":"获取所有数据库","description":"获取所有数据库","operationId":"get_dbs_dbs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Dbs Dbs Get","type":"object"}}}}}}},"/{db}/tables":{"get":{"summary":"获取 db 中所有表","description":"获取 db 中所有表\n\nArgs:\n db (str): 数据库名(可通过 `get_dbs` 查询)\n\nReturns:\n List[dict]: `db` 下的所有表名及对应建表语句","operationId":"get_tables__db__tables_get","parameters":[{"required":true,"schema":{"title":"Db","type":"string"},"name":"db","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Get Tables Db Tables Get","type":"object"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/text":{"post":{"summary":"发送文本消息","description":"发送文本消息,可参考:https://github.com/lich0821/WeChatRobot/blob/master/robot.py 里 sendTextMsg\n\nArgs:\n msg (str): 要发送的消息,换行使用 `\\\\n`;如果 @ 人的话,需要带上跟 `aters` 里数量相同的 @\n receiver (str): 消息接收人,wxid 或者 roomid\n aters (str): 要 @ 的 wxid,多个用逗号分隔;`@所有人` 只需要 `notify@all`\n\nReturns:\n int: 0 为成功,其他失败","operationId":"send_text_text_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_send_text_text_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Send Text Text Post","type":"object"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/image":{"post":{"summary":"发送图片消息","description":"发送图片,非线程安全\n\nArgs:\n path (str): 图片路径,如:`C:/Projs/WeChatRobot/TEQuant.jpeg` 或 `https://raw.githubusercontent.com/lich0821/WeChatRobot/master/TEQuant.jpeg`\n receiver (str): 消息接收人,wxid 或者 roomid\n\nReturns:\n int: 0 为成功,其他失败","operationId":"send_image_image_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_send_image_image_post"}}}},"responses":{"200":{"dLine truncated
+1 -1
View File
@@ -33,7 +33,7 @@ setup(
"setuptools",
"fastapi",
"uvicorn[standard]",
"wcferry==37.1.25.5",
"wcferry==39.0.0.0a3",
],
classifiers=[
"Environment :: Win32 (MS Windows)",
+9 -7
View File
@@ -10,7 +10,7 @@ from fastapi import Body, FastAPI
from pydantic import BaseModel
from wcferry import Wcf, WxMsg
__version__ = "37.1.25.5"
__version__ = "39.0.0.0a3"
class Msg(BaseModel):
@@ -50,8 +50,8 @@ class Http(FastAPI):
self.add_api_route("/text", self.send_text, methods=["POST"], summary="发送文本消息")
self.add_api_route("/image", self.send_image, methods=["POST"], summary="发送图片消息")
self.add_api_route("/file", self.send_file, methods=["POST"], summary="发送文件消息")
self.add_api_route("/xml", self.send_xml, methods=["POST"], summary="发送 XML 消息")
self.add_api_route("/emotion", self.send_emotion, methods=["POST"], summary="发送表情消息")
# self.add_api_route("/xml", self.send_xml, methods=["POST"], summary="发送 XML 消息")
# self.add_api_route("/emotion", self.send_emotion, methods=["POST"], summary="发送表情消息")
self.add_api_route("/sql", self.query_sql, methods=["POST"], summary="执行 SQL,如果数据量大注意分页,以免 OOM")
self.add_api_route("/new-friend", self.accept_new_friend, methods=["POST"], summary="通过好友申请")
self.add_api_route("/chatroom-member", self.add_chatroom_members, methods=["POST"], summary="添加群成员")
@@ -156,13 +156,13 @@ class Http(FastAPI):
def send_text(
self, msg: str = Body(description="要发送的消息,换行用\\n表示"),
receiver: str = Body("filehelper", description="消息接收者,roomid 或者 wxid"),
aters: str = Body("", description="要 @ 的 wxid,多个用逗号分隔;@所有人 用 nofity@all")) -> dict:
aters: str = Body("", description="要 @ 的 wxid,多个用逗号分隔;@所有人 用 notify@all")) -> dict:
"""发送文本消息,可参考:https://github.com/lich0821/WeChatRobot/blob/master/robot.py 里 sendTextMsg
Args:
msg (str): 要发送的消息,换行使用 `\\n`;如果 @ 人的话,需要带上跟 `aters` 里数量相同的 @
receiver (str): 消息接收人,wxid 或者 roomid
aters (str): 要 @ 的 wxid,多个用逗号分隔;`@所有人` 只需要 `nofity@all`
aters (str): 要 @ 的 wxid,多个用逗号分隔;`@所有人` 只需要 `notify@all`
Returns:
int: 0 为成功,其他失败
@@ -293,17 +293,19 @@ class Http(FastAPI):
def receive_transfer(self,
wxid: str = Body("wxid_xxxxxxxxxxxxx", description="转账消息里的发送人 wxid"),
transferid: str = Body("transferid", description="转账消息里的 transferid")) -> dict:
transferid: str = Body("transferid", description="转账消息里的 transferid"),
transactionid: str = Body("transactionid", description="转账消息里的 transactionid")) -> dict:
"""接收转账
Args:
wxid (str): 转账消息里的发送人 wxid
transferid (str): 转账消息里的 transferid
transactionid (str): 转账消息里的 transactionid
Returns:
int: 1 为成功,其他失败
"""
ret = self.wcf.receive_transfer(wxid, transferid)
ret = self.wcf.receive_transfer(wxid, transferid, transactionid)
return {"status": ret, "message": "成功"if ret == 1 else "失败"}
def decrypt_image(self,
+2 -2
View File
@@ -1,7 +1,7 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
__version__ = "39.0.0.0a2"
__version__ = "39.0.0.0a3"
import atexit
import base64
@@ -236,7 +236,7 @@ class Wcf():
Args:
msg (str): 要发送的消息,换行使用 `\\n`;如果 @ 人的话,需要带上跟 `aters` 里数量相同的 @
receiver (str): 消息接收人,wxid 或者 roomid
aters (str): 要 @ 的 wxid,多个用逗号分隔;`@所有人` 只需要 `nofity@all`
aters (str): 要 @ 的 wxid,多个用逗号分隔;`@所有人` 只需要 `notify@all`
Returns:
int: 0 为成功,其他失败
+1 -1
View File
@@ -6,7 +6,7 @@
#define SUPPORT_VERSION L"3.9.2.23"
WxCalls_t wxCalls = {
0x2FFD638, // Login Status
{ 0x2FFD4E8, 0x2FFD590, 0x2FFD500, 0x30238CC }, // User Info: wxid, nickname, mobile, home
{ 0x2FFD484, 0x2FFD590, 0x2FFD500, 0x30238CC }, // User Info: wxid, nickname, mobile, home
{ 0x768140, 0xCE6C80, 0x756960 }, // Send Message
/* Receive Message:
Hook, call, type, self, id, msgXml, roomId, wxId, content, thumb, extra */