Skip to main content

A Python SDK for QQ Bot.

Project description

cyan

Pipeline Status Python Version PyPI - License PyPI


简介

Cyan 是一个简单易用的 QQ 机器人 Python SDK,基于 Python 的类型注解和异步特性。

项目状态

项目目前处于测试阶段,这意味着 SDK 所提供的操作不稳定,不建议用于生产环境。

仓库

HuajiTech GitLab(主仓库):https://gitlab.huajitech.net/huajitech/cyan

GitHub:https://github.com/huajitech/cyan

特性

  • 异步操作:使用 httpxwebsockets 异步框架及 Python 的异步特性
  • 化繁为简:简化 API 繁琐的操作,使用户容易上手
  • 类型注释:SDK 100% 使用类型注解,通过 Pyright严格检查,用户可使用支持类型检查的 IDE 减少 Bug 出现的可能性
  • 支持扩展:SDK 开放与 API 交互的函数,用户可通过提供的函数与 API 交互,实现 SDK 未实现的功能

如何使用

通过 pip 安装 Cyan:

pip install cyansdk

文档:https://huajitech.proj.zone/cyan

示例

from cyan import Session, Ticket
from cyan.event.events import ChannelMessageReceivedEvent
from cyan.model import Message

session = Session(
    "https://sandbox.api.sgroup.qq.com/",
    Ticket("{app_id}", "{token}")
)


@session.on(ChannelMessageReceivedEvent)
async def message_received(data: Message):
    await data.reply("收到消息:\n", data)

session.run()

更多

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cyansdk-0.1.1.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cyansdk-0.1.1-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file cyansdk-0.1.1.tar.gz.

File metadata

  • Download URL: cyansdk-0.1.1.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.10.0 Linux/5.11.0-49-generic

File hashes

Hashes for cyansdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e0d4827f5f3d19ebc737dabc4f11236d26cd34fae164f982f25fe985af7d5412
MD5 675bd70ded5240f06f4de6a03bab2371
BLAKE2b-256 cac228a6fa181541c21c55dd81dab151699140e5901c68dc79e07939a4f95e14

See more details on using hashes here.

File details

Details for the file cyansdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cyansdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.10.0 Linux/5.11.0-49-generic

File hashes

Hashes for cyansdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3343920a66167eb933854e8194c5c1281deb4f47d74502236cd27e5080440b6e
MD5 69b86ea380906049effe7e764c12dd76
BLAKE2b-256 231d5900cc2a11aa2d0743976f14abd13baafd2d980ce66d554dbcdd412d4484

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page