A Python SDK for QQ Bot.
Project description
简介
Cyan 是一个简单易用的 QQ 机器人 Python SDK,基于 Python 的类型注解和异步特性。
项目状态
项目目前处于测试阶段,这意味着 SDK 所提供的操作不稳定,不建议用于生产环境。
仓库
HuajiTech GitLab(主仓库):https://gitlab.huajitech.net/huajitech/cyan
GitHub:https://github.com/huajitech/cyan
特性
- 异步操作:使用
httpx、websockets异步框架及 Python 的异步特性 - 化繁为简:简化 API 繁琐的操作,使用户容易上手
- 类型注释:SDK 100% 使用类型注解,通过
Pyright的严格检查,用户可使用支持类型检查的 IDE 减少 Bug 出现的可能性 - 支持扩展:SDK 开放与 API 交互的函数,用户可通过提供的函数与 API 交互,实现 SDK 未实现的功能
如何使用
安装
-
通过
pip安装 Cyan (release):pip install cyansdk
-
通过
pip安装 Cyan (nightly):https://gitlab.huajitech.net/huajitech/cyan/-/packages
文档
https://huajitech.proj.zone/cyan
示例
from cyan import Session, Ticket
from cyan.event import ChannelMessageReceivedEvent
from cyan.model import ChannelMessage
session = Session(
"https://sandbox.api.sgroup.qq.com/",
Ticket("{app_id}", "{token}")
)
@session.on(ChannelMessageReceivedEvent)
async def message_received(data: ChannelMessage):
await data.reply("收到消息:\n", data)
session.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cyansdk-0.2.0.tar.gz.
File metadata
- Download URL: cyansdk-0.2.0.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.1 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f97ca97b38784c83aa95c1bd53fe5d8ef57c5b6903e925364497644ff12554f0
|
|
| MD5 |
ae74431ed6c63e20271714e0b54ac5ce
|
|
| BLAKE2b-256 |
d7ce11713f8c762d20b52df4eeec06e50af193b56dbeb207d0ce40b998f477e8
|
File details
Details for the file cyansdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cyansdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 35.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.10.2 Linux/5.11.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ea78b55edac64558e3718e2aa3eb18209e2b8e0ecc0cdd68cd96991f52c36cb
|
|
| MD5 |
4d6dbed365e2fd7ea465c4c298033cf8
|
|
| BLAKE2b-256 |
c26330be026472750ccb75251b3d0856cfd955bfdbca9e80314e43339b731202
|