Skip to main content

A Python SDK for QQ Bot.

Project description

cyan

Pipeline Status Python Version PyPI - License PyPI - Version PyPI - Downloads


简介

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 未实现的功能

如何使用

安装

  1. 通过 pip 安装 Cyan (release):

    pip install cyansdk
    
  2. 通过 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


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.2.0.tar.gz (24.6 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.2.0-py3-none-any.whl (35.2 kB view details)

Uploaded Python 3

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

Hashes for cyansdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f97ca97b38784c83aa95c1bd53fe5d8ef57c5b6903e925364497644ff12554f0
MD5 ae74431ed6c63e20271714e0b54ac5ce
BLAKE2b-256 d7ce11713f8c762d20b52df4eeec06e50af193b56dbeb207d0ce40b998f477e8

See more details on using hashes here.

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

Hashes for cyansdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ea78b55edac64558e3718e2aa3eb18209e2b8e0ecc0cdd68cd96991f52c36cb
MD5 4d6dbed365e2fd7ea465c4c298033cf8
BLAKE2b-256 c26330be026472750ccb75251b3d0856cfd955bfdbca9e80314e43339b731202

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