From 5251487872efdcac4c9dcf7f4efdab595d05c050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=8E=E6=98=8E?= Date: Mon, 6 May 2024 19:42:57 +0800 Subject: [PATCH] version 0.0.6 --- setup.py | 2 +- wxhook/__init__.py | 2 +- wxhook/core.py | 16 ++++++++-------- wxhook/utils.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index e459682..e86bf86 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ URL = 'https://github.com/miloira/wxhook' EMAIL = '690126048@qq.com' AUTHOR = 'Msky' REQUIRES_PYTHON = '>=3.8.0' -VERSION = '0.0.5' +VERSION = '0.0.6' # What packages are required for this module to be executed? REQUIRED = [ diff --git a/wxhook/__init__.py b/wxhook/__init__.py index 30bc681..5ceaa1f 100644 --- a/wxhook/__init__.py +++ b/wxhook/__init__.py @@ -1,3 +1,3 @@ from .core import Bot -version = "0.0.5" +version = "0.0.6" diff --git a/wxhook/core.py b/wxhook/core.py index 3af7377..7b7e88d 100644 --- a/wxhook/core.py +++ b/wxhook/core.py @@ -210,7 +210,7 @@ class Bot: } return Response(**self.call_api("/api/sendApplet", json=data)) - def send_room_at(self, room_id: str, wxids: list[str], msg: str) -> Response: + def send_room_at(self, room_id: str, wxids: typing.List[str], msg: str) -> Response: """发送群@消息""" data = { "chatRoomId": room_id, @@ -227,7 +227,7 @@ class Bot: } return Response(**self.call_api("/api/sendPatMsg", json=data)) - def get_contacts(self) -> list[Contact]: + def get_contacts(self) -> typing.List[Contact]: """获取联系人列表""" return [Contact(**item) for item in self.call_api("/api/getContactList")["data"]] @@ -238,7 +238,7 @@ class Bot: } return ContactDetail(**self.call_api("/api/getContactProfile", json=data)["data"]) - def create_room(self, member_ids: list[str]) -> Response: + def create_room(self, member_ids: typing.List[str]) -> Response: """创建群聊""" data = { "memberIds": ",".join(member_ids) @@ -266,7 +266,7 @@ class Bot: } return RoomMembers(**self.call_api("/api/getMemberFromChatRoom", json=data)["data"]) - def add_room_member(self, room_id: str, member_ids: list[str]) -> Response: + def add_room_member(self, room_id: str, member_ids: typing.List[str]) -> Response: """添加群成员""" data = { "chatRoomId": room_id, @@ -274,7 +274,7 @@ class Bot: } return Response(**self.call_api("/api/addMemberToChatRoom", json=data)) - def delete_room_member(self, room_id: str, member_ids: list[str]) -> Response: + def delete_room_member(self, room_id: str, member_ids: typing.List[str]) -> Response: """删除群成员""" data = { "chatRoomId": room_id, @@ -282,7 +282,7 @@ class Bot: } return Response(**self.call_api("/api/delMemberFromChatRoom", json=data)) - def invite_room_member(self, room_id: str, member_ids: list[str]) -> Response: + def invite_room_member(self, room_id: str, member_ids: typing.List[str]) -> Response: """邀请群成员""" data = { "chatRoomId": room_id, @@ -408,7 +408,7 @@ class Bot: } return Response(**self.call_api("/api/ocr", json=data)) - def get_db_info(self) -> list[DB]: + def get_db_info(self) -> typing.List[DB]: """获取数据库句柄""" return [DB(databaseName=item["databaseName"], handle=item["handle"], tables=[Table(**sub_item) for sub_item in item["tables"]]) for item in self.call_api("/api/getDBInfo")] @@ -443,7 +443,7 @@ class Bot: logger.error(traceback.format_exc()) logger.error(raw_data) - def handle(self, events: typing.Union[list[str], str, None] = None, once: bool = False) -> typing.Callable[[typing.Callable], None]: + def handle(self, events: typing.Union[typing.List[str], str, None] = None, once: bool = False) -> typing.Callable[[typing.Callable], None]: def wrapper(func): listen = self.event_emitter.on if not once else self.event_emitter.once if not events: diff --git a/wxhook/utils.py b/wxhook/utils.py index fc7fcb2..e65f57d 100644 --- a/wxhook/utils.py +++ b/wxhook/utils.py @@ -25,7 +25,7 @@ def fake_wechat_version(pid: int, old_version: str, new_version: str) -> int: return int(result.stdout) -def get_processes(process_name: str) -> list[psutil.Process]: +def get_processes(process_name: str) -> typing.List[psutil.Process]: processes = [] for process in psutil.process_iter(): if process.name().lower() == process_name.lower(): @@ -80,7 +80,7 @@ class WeChatManager: with open(self.filename, "w", encoding="utf-8") as file: json.dump(data, file) - def refresh(self, pid_list: list[int]) -> None: + def refresh(self, pid_list: typing.List[int]) -> None: data = self.read() cleaned_data = [] remote_port_list = [19000]