From 68223ecd164ab8caa3b0b10c54a4db87af151079 Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Mon, 24 Apr 2023 11:26:52 +0800 Subject: [PATCH 1/6] =?UTF-8?q?chore:=20=E7=A7=BB=E5=8A=A8examples?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {examples => nakuru/examples}/forward_message.py | 0 {examples => nakuru/examples}/src/1.jpg | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename {examples => nakuru/examples}/forward_message.py (100%) rename {examples => nakuru/examples}/src/1.jpg (100%) diff --git a/examples/forward_message.py b/nakuru/examples/forward_message.py similarity index 100% rename from examples/forward_message.py rename to nakuru/examples/forward_message.py diff --git a/examples/src/1.jpg b/nakuru/examples/src/1.jpg similarity index 100% rename from examples/src/1.jpg rename to nakuru/examples/src/1.jpg From b1b4fb82ff4d8b2c97882d0e2f2169b80a614282 Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Mon, 24 Apr 2023 11:27:53 +0800 Subject: [PATCH 2/6] =?UTF-8?q?chore:=20=E6=B7=BB=E5=8A=A0pyproject.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e7f1be7 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "nakuru-project-idk" +version = "1.0.0" +authors = [ + { name="Lxns-Network", email="joinchang1206@gmail.com" }, +] +description = "一款为 go-cqhttp 的正向 WebSocket 设计的 Python SDK,支持纯 CQ 码与消息链的转换处理" +readme = "README.md" +requires-python = ">=3.7" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] +dependencies = [ + "aiohttp", + "pydantic", + "Logbook", + "async_lru" +] + +[project.urls] +"Homepage" = "https://github.com/idoknow/nakuru-project-idk" +"Bug Tracker" = "https://github.com/idoknow/nakuru-project-idk/issues" \ No newline at end of file From a3ecf4886deb38602ea4b45febc473a38e83b92e Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Mon, 24 Apr 2023 11:28:27 +0800 Subject: [PATCH 3/6] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E4=B8=BA0.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e7f1be7..2d6d35e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "nakuru-project-idk" -version = "1.0.0" +version = "0.0.1" authors = [ { name="Lxns-Network", email="joinchang1206@gmail.com" }, ] From 878fadb47aa0541f6b6ebcad4ac0886c6ecd6207 Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Mon, 24 Apr 2023 11:31:27 +0800 Subject: [PATCH 4/6] =?UTF-8?q?chore:=20=E6=8E=92=E9=99=A4dist=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f749f52..9266097 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store -__pycache__ \ No newline at end of file +__pycache__ +dist/* \ No newline at end of file From 8eb604058d96d1c2df089927c83c3356bc8e0066 Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Mon, 24 Apr 2023 14:34:08 +0800 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20send=5Fprivate=5Fforward=5Fmsg?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- nakuru/protocol.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9266097..e7d3482 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store __pycache__ -dist/* \ No newline at end of file +dist/* +test_* \ No newline at end of file diff --git a/nakuru/protocol.py b/nakuru/protocol.py index 47116e2..3991b11 100644 --- a/nakuru/protocol.py +++ b/nakuru/protocol.py @@ -63,6 +63,21 @@ async def sendGroupForwardMessage(self, if result["status"] == "ok": return BotMessage.parse_obj(result["data"]) return False + + async def sendPrivateForwardMessage(self, + user_id: int, + messages: list) -> T.Union[BotMessage, bool]: + for i in range(len(messages)): + if isinstance(messages[i], Node): + messages[i] = messages[i].toDict() + + result = await fetch.http_post(f"{self.baseurl_http}/send_private_forward_msg", { + "user_id": user_id, + "messages": messages + }, params=self.protocol_params) + if result["status"] == "ok": + return BotMessage.parse_obj(result["data"]) + return False async def recall(self, message_id: int) -> bool: result = await fetch.http_post(f"{self.baseurl_http}/delete_msg", { From a7156c7c80f088f2b8ff9593c4364c49c595d772 Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Mon, 24 Apr 2023 14:41:58 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20getLoginInfo=E7=9A=84401=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nakuru/protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nakuru/protocol.py b/nakuru/protocol.py index 3991b11..cd14ccb 100644 --- a/nakuru/protocol.py +++ b/nakuru/protocol.py @@ -270,7 +270,7 @@ async def setGroupRequest(self, return False async def getLoginInfo(self) -> T.Union[Bot, bool]: - result = await fetch.http_post(f"{self.baseurl_http}/get_login_info") + result = await fetch.http_post(f"{self.baseurl_http}/get_login_info", params=self.protocol_params) if result["status"] == "ok": return Bot.parse_obj(result["data"]) return False