v39.0.14.0
This commit is contained in:
parent
69db15752f
commit
03a29c86c8
@ -44,9 +44,9 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc
|
|||||||
|
|
||||||
## 版本更新
|
## 版本更新
|
||||||
|
|
||||||
### v39.0.12 (2023.12.20)
|
### v39.0.14.0 (2024.02.18)
|
||||||
* 修复一个问题
|
* 若干优化
|
||||||
* 消息转发
|
* 若干功能
|
||||||
|
|
||||||
<details><summary>点击查看更多</summary>
|
<details><summary>点击查看更多</summary>
|
||||||
|
|
||||||
@ -86,5 +86,7 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc
|
|||||||
* 邀请群成员
|
* 邀请群成员
|
||||||
* 图片 OCR
|
* 图片 OCR
|
||||||
* 转发消息
|
* 转发消息
|
||||||
|
* 撤回消息
|
||||||
|
* 获取登录二维码
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__version__ = "39.0.12.0"
|
__version__ = "39.0.14.0"
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
import base64
|
import base64
|
||||||
@ -55,13 +55,13 @@ class Wcf():
|
|||||||
host (str): `wcferry` RPC 服务器地址,默认本地启动;也可以指定地址连接远程服务
|
host (str): `wcferry` RPC 服务器地址,默认本地启动;也可以指定地址连接远程服务
|
||||||
port (int): `wcferry` RPC 服务器端口,默认为 10086,接收消息会占用 `port+1` 端口
|
port (int): `wcferry` RPC 服务器端口,默认为 10086,接收消息会占用 `port+1` 端口
|
||||||
debug (bool): 是否开启调试模式(仅本地启动有效)
|
debug (bool): 是否开启调试模式(仅本地启动有效)
|
||||||
|
block (bool): 是否阻塞等待微信登录,不阻塞的话可以手动获取登录二维码主动登录
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
contacts (list): 联系人缓存,调用 `get_contacts` 后更新
|
contacts (list): 联系人缓存,调用 `get_contacts` 后更新
|
||||||
self_wxid (str): 登录账号 wxid
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, host: str = None, port: int = 10086, debug: bool = True) -> None:
|
def __init__(self, host: str = None, port: int = 10086, debug: bool = True, block: bool = True) -> None:
|
||||||
self._local_mode = False
|
self._local_mode = False
|
||||||
self._is_running = False
|
self._is_running = False
|
||||||
self._is_receiving_msg = False
|
self._is_receiving_msg = False
|
||||||
@ -98,14 +98,15 @@ class Wcf():
|
|||||||
self.msg_url = self.cmd_url.replace(str(self.port), str(self.port + 1))
|
self.msg_url = self.cmd_url.replace(str(self.port), str(self.port + 1))
|
||||||
|
|
||||||
atexit.register(self.cleanup) # 退出的时候停止消息接收,防止资源占用
|
atexit.register(self.cleanup) # 退出的时候停止消息接收,防止资源占用
|
||||||
while not self.is_login(): # 等待微信登录成功
|
|
||||||
sleep(1)
|
|
||||||
|
|
||||||
self._is_running = True
|
self._is_running = True
|
||||||
self.contacts = []
|
self.contacts = []
|
||||||
self.msgQ = Queue()
|
self.msgQ = Queue()
|
||||||
self._SQL_TYPES = {1: int, 2: float, 3: lambda x: x.decode("utf-8"), 4: bytes, 5: lambda x: None}
|
self._SQL_TYPES = {1: int, 2: float, 3: lambda x: x.decode("utf-8"), 4: bytes, 5: lambda x: None}
|
||||||
self.self_wxid = self.get_self_wxid()
|
if block:
|
||||||
|
self.LOG.info("等待微信登录...")
|
||||||
|
while not self.is_login(): # 等待微信登录成功
|
||||||
|
sleep(1)
|
||||||
|
|
||||||
def __del__(self) -> None:
|
def __del__(self) -> None:
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
@ -145,6 +146,14 @@ class Wcf():
|
|||||||
"""是否已启动接收消息功能"""
|
"""是否已启动接收消息功能"""
|
||||||
return self._is_receiving_msg
|
return self._is_receiving_msg
|
||||||
|
|
||||||
|
def get_qrcode(self) -> str:
|
||||||
|
"""获取登录二维码,已经登录则返回空字符串"""
|
||||||
|
req = wcf_pb2.Request()
|
||||||
|
req.func = wcf_pb2.FUNC_REFRESH_QRCODE # FUNC_REFRESH_QRCODE
|
||||||
|
rsp = self._send_request(req)
|
||||||
|
|
||||||
|
return rsp.str
|
||||||
|
|
||||||
def is_login(self) -> bool:
|
def is_login(self) -> bool:
|
||||||
"""是否已经登录"""
|
"""是否已经登录"""
|
||||||
req = wcf_pb2.Request()
|
req = wcf_pb2.Request()
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user