diff --git a/.gitignore b/.gitignore index f749f52..e7d3482 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .DS_Store -__pycache__ \ No newline at end of file +__pycache__ +dist/* +test_* \ No newline at end of file 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 diff --git a/nakuru/protocol.py b/nakuru/protocol.py index 47116e2..cd14ccb 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", { @@ -255,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 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2d6d35e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,28 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "nakuru-project-idk" +version = "0.0.1" +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