feat: bump to v39.5.2

This commit is contained in:
Changhua 2025-04-30 00:23:49 +08:00
parent 36e1bbddd9
commit 3f7dfa1190
4 changed files with 39 additions and 16 deletions

View File

@ -9,7 +9,7 @@
</details> </details>
|[📖 Python 文档](https://wechatferry.readthedocs.io/)|[📺 Python 视频教程](https://mp.weixin.qq.com/s/APdjGyZ2hllXxyG_sNCfXQ)|[🙋 FAQ](https://mp.weixin.qq.com/s/OF8Hyxrkp8JGuVdRK8nyFA)| |[📖 Python 文档](https://wechatferry.readthedocs.io/)|[📺 Python 视频教程](https://mp.weixin.qq.com/s/APdjGyZ2hllXxyG_sNCfXQ)|[🙋 FAQ](https://mp.weixin.qq.com/s/c2JggTBlOP8fP9j-MlMAvg)|
|:-:|:-:|:-:| |:-:|:-:|:-:|
👉 [WeChatRobot🤖](https://github.com/lich0821/WeChatRobot),一个基于 WeChatFerry 的 Python 机器人示例。 👉 [WeChatRobot🤖](https://github.com/lich0821/WeChatRobot),一个基于 WeChatFerry 的 Python 机器人示例。
@ -207,9 +207,8 @@ WeChatFerry
## 版本更新 ## 版本更新
### v39.5.1 ### v39.5.2
* 修复邀请进群偶发失败 * 没有新功能
* 修复获取 wxid 失败
<details><summary>点击查看更多</summary> <details><summary>点击查看更多</summary>
@ -221,6 +220,10 @@ WeChatFerry
* `y` 是 `WeChatFerry` 的版本,从 0 开始 * `y` 是 `WeChatFerry` 的版本,从 0 开始
* `z` 是各客户端的版本,从 0 开始 * `z` 是各客户端的版本,从 0 开始
### v39.5.1
* 修复邀请进群偶发失败
* 修复获取 wxid 失败
### v39.5.0 ### v39.5.0
* 适配 `3.9.12.51`。 * 适配 `3.9.12.51`。

View File

@ -51,7 +51,7 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 39,5,1,0 FILEVERSION 39,5,2,0
PRODUCTVERSION 3,9,12,51 PRODUCTVERSION 3,9,12,51
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
@ -69,7 +69,7 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "WeChatFerry" VALUE "CompanyName", "WeChatFerry"
VALUE "FileDescription", "WeChatFerry" VALUE "FileDescription", "WeChatFerry"
VALUE "FileVersion", "39.5.1.0" VALUE "FileVersion", "39.5.2.0"
VALUE "InternalName", "spy.dll" VALUE "InternalName", "spy.dll"
VALUE "LegalCopyright", "Copyright (C) 2023" VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", "spy.dll" VALUE "OriginalFilename", "spy.dll"

View File

@ -1,7 +1,7 @@
# WeChatFerry Python 客户端 # WeChatFerry Python 客户端
[![PyPi](https://img.shields.io/pypi/v/wcferry.svg)](https://pypi.python.org/pypi/wcferry) [![Downloads](https://static.pepy.tech/badge/wcferry)](https://pypi.python.org/pypi/wcferry) [![Documentation Status](https://readthedocs.org/projects/wechatferry/badge/?version=latest)](https://wechatferry.readthedocs.io/zh/latest/?badge=latest) [![PyPi](https://img.shields.io/pypi/v/wcferry.svg)](https://pypi.python.org/pypi/wcferry) [![Downloads](https://static.pepy.tech/badge/wcferry)](https://pypi.python.org/pypi/wcferry) [![Documentation Status](https://readthedocs.org/projects/wechatferry/badge/?version=latest)](https://wechatferry.readthedocs.io/zh/latest/?badge=latest)
|[📖 Python 文档](https://wechatferry.readthedocs.io/)|[📺 Python 视频教程](https://mp.weixin.qq.com/s/APdjGyZ2hllXxyG_sNCfXQ)|[🙋 FAQ](https://mp.weixin.qq.com/s/woR71GfODIOBkkj6SQUKQg)| |[📖 Python 文档](https://wechatferry.readthedocs.io/)|[📺 Python 视频教程](https://mp.weixin.qq.com/s/APdjGyZ2hllXxyG_sNCfXQ)|[🙋 FAQ](https://mp.weixin.qq.com/s/c2JggTBlOP8fP9j-MlMAvg)|
|:-:|:-:|:-:| |:-:|:-:|:-:|
🤖示例机器人框架:[WeChatRobot](https://github.com/lich0821/WeChatRobot)。 🤖示例机器人框架:[WeChatRobot](https://github.com/lich0821/WeChatRobot)。
@ -44,8 +44,8 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc
## 版本更新 ## 版本更新
### v39.5.1.0 ### v39.5.2.0
* Bug 修复。 * 没有新功能
<details><summary>点击查看更多</summary> <details><summary>点击查看更多</summary>

View File

@ -1,11 +1,13 @@
#! /usr/bin/env python3 #! /usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
__version__ = "39.5.1.0" __version__ = "39.5.2.0"
import atexit import atexit
import base64 import base64
import ctypes import ctypes
import ctypes.wintypes
import gc
import logging import logging
import mimetypes import mimetypes
import os import os
@ -80,10 +82,7 @@ class Wcf():
if host is None: if host is None:
self._local_mode = True self._local_mode = True
self.host = "127.0.0.1" self.host = "127.0.0.1"
self.sdk = ctypes.cdll.LoadLibrary(f"{self._wcf_root}/sdk.dll") self._sdk_init(debug, port)
if self.sdk.WxInitSDK(debug, port) != 0:
self.LOG.error("初始化失败!")
os._exit(-1)
self.cmd_url = f"tcp://{self.host}:{self.port}" self.cmd_url = f"tcp://{self.host}:{self.port}"
@ -125,6 +124,27 @@ class Wcf():
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
self.LOG.error(f"修改控制台代码页失败: {e}") self.LOG.error(f"修改控制台代码页失败: {e}")
def _sdk_init(self, debug, port):
sdk = ctypes.cdll.LoadLibrary(f"{self._wcf_root}/sdk.dll")
if sdk.WxInitSDK(debug, port) != 0:
self.LOG.error("初始化失败!")
os._exit(-1)
# 主动卸载
ctypes.windll.kernel32.FreeLibrary.argtypes = [ctypes.wintypes.HMODULE]
ctypes.windll.kernel32.FreeLibrary(sdk._handle)
del sdk # 删除 Python 对象、触发垃圾回收
gc.collect()
def _sdk_destroy(self):
sdk = ctypes.cdll.LoadLibrary(f"{self._wcf_root}/sdk.dll")
sdk.WxDestroySDK()
# 主动卸载
ctypes.windll.kernel32.FreeLibrary.argtypes = [ctypes.wintypes.HMODULE]
ctypes.windll.kernel32.FreeLibrary(sdk._handle)
del sdk # 删除 Python 对象、触发垃圾回收
gc.collect()
def cleanup(self) -> None: def cleanup(self) -> None:
"""关闭连接,回收资源""" """关闭连接,回收资源"""
if not self._is_running: if not self._is_running:
@ -139,7 +159,7 @@ class Wcf():
self.cmd_socket.close() self.cmd_socket.close()
self.msg_socket.close() self.msg_socket.close()
if self._local_mode and self.sdk and self.sdk.WxDestroySDK() != 0: if self._local_mode and self.sdk and self._sdk_destroy() != 0:
self.LOG.error("退出失败!") self.LOG.error("退出失败!")
self._is_running = False self._is_running = False
@ -669,7 +689,7 @@ class Wcf():
if (cnt["wxid"].endswith("@chatroom") or # 群聊 if (cnt["wxid"].endswith("@chatroom") or # 群聊
cnt["wxid"].startswith("gh_") or # 公众号 cnt["wxid"].startswith("gh_") or # 公众号
cnt["wxid"] in not_friends.keys() # 其他杂号 cnt["wxid"] in not_friends.keys() # 其他杂号
): ):
continue continue
friends.append(cnt) friends.append(cnt)