Nakuru Project
这是由idoknow维护的分支
一款为 go-cqhttp 的正向 WebSocket 设计的 Python SDK,支持纯 CQ 码与消息链的转换处理
在 kuriyama 的基础上改动
项目名来源于藍月なくる,图标由せら绘制
食用方法
使用 pip install nakuru-project-idk 安装。
需要将 go-cqhttp 的正向 WebSocket 与 HTTP 配置项开启。
示例
没有文档,源码就是文档。
from nakuru import (
CQHTTP,
GroupMessage,
Notify,
GroupMessageRecall,
FriendRequest
)
from nakuru.entities.components import Plain, Image
app = CQHTTP(
host="127.0.0.1",
port=6700,
http_port=5700,
token="TOKEN" # 可选,如果配置了 Access-Token
)
@app.receiver("GroupMessage")
async def _(app: CQHTTP, source: GroupMessage):
# 通过纯 CQ 码处理
if source.raw_message == "戳我":
await app.sendGroupMessage(source.group_id, f"[CQ:poke,qq={source.user_id}]")
# 通过消息链处理
chain = source.message
if isinstance(chain[0], Plain):
if chain[0].text == "看":
await app.sendGroupMessage(source.group_id, [
Plain(text="给你看"),
Image.fromFileSystem("D:/好康的.jpg")
])
@app.receiver("GroupMessageRecall")
async def _(app: CQHTTP, source: GroupMessageRecall):
await app.sendGroupMessage(source.group_id, "你撤回了一条消息")
@app.receiver("Notify")
async def _(app: CQHTTP, source: Notify):
if source.sub_type == "poke" and source.target_id == 114514:
await app.sendGroupMessage(source.group_id, "不许戳我")
@app.receiver("FriendRequest")
async def _(app: CQHTTP, source: FriendRequest):
await app.setFriendRequest(source.flag, True)
app.run()
贡献
欢迎 PR 代码或提交 Issue,项目现在还存在着许多问题。
Metadata
Release files for nakuru-project-idk 0.0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nakuru_project_idk-0.0.2.1.tar.gz | 350.7 kB | Without provenance | Details for nakuru_project_idk-0.0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nakuru_project_idk-0.0.2.1-py3-none-any.whl | Python 3 | none | any | Details for nakuru_project_idk-0.0.2.1-py3-none-any.whl |
Total release size: 375.0 kB
Release files / nakuru_project_idk-0.0.2.1.tar.gz
| Download URL | nakuru_project_idk-0.0.2.1.tar.gz |
|---|---|
| Size | 350.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3012a0076d3faeeb1d8b790e7c2cf9eb14962752e50340ab50d735a2f42c2a8e
|
|
BLAKE2b-256 checksum How to use checksums |
4d022e59ed6a70452b669412a7b89fb9c14396f61fb63b30797c3263cae7ea04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Release files / nakuru_project_idk-0.0.2.1-py3-none-any.whl
| Download URL | nakuru_project_idk-0.0.2.1-py3-none-any.whl |
|---|---|
| Size | 24.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bddd8af8a46ef381bd05b806d6c07bd8ba407c58b47ce6148d750bd77c4420bc
|
|
BLAKE2b-256 checksum How to use checksums |
4a675c9c8f1ba4a599e35a77ca7e0a0210ab6cd732f719bc3b0fc95c69aaca10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Security for nakuru-project-idk 0.0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.