✨ Yet Another Bot Framework for Tencent QQ Written in Python ✨
声明
一切开发旨在学习,请勿用于非法用途
CAI是完全免费且开放源代码的软件,仅供学习和娱乐用途使用CAI不会通过任何方式强制收取费用,或对使用者提出物质条件
许可证
CAI 采用 AGPLv3 协议开源,不鼓励、不支持一切商业使用。
特色
-
简单易用的 API,支持多账号
-
极少的额外依赖
完整的 Type Hints(pep-0484)
-
Packet Query 支持 Variadic Generics
from cai.utils.binary import Packet packet = Packet(bytes.fromhex("01000233000000")) packet.start().int8().uint16().bytes(4).execute() # return type: INT8, UINT16, BYTES
-
便携的 JceStruct 定义 (使用方法参考 JceStruct)
from typing import Optional from jce import JceStruct, JceField, types class CustomStruct(JceStruct): int32_field: types.INT32 = JceField(jce_id=0) optional_field: Optional[types.DOUBLE] = JceField(None, jce_id=1) nested_field: OtherStruct = JceField(jce_id=2)
-
功能
CAI 仅作为底层协议库使用,将协议封装为 API。
CAI不会支持涉及 金钱、主动邀请、获取凭证 等敏感操作的协议。
已支持的协议列表:
登录
- 账号密码登录
- 设备锁验证
- 图片验证码提交
- 短信验证码提交
- 扫码登录
- 短信验证码
客户端
- 设置在线状态
- 上传图片/音频/视频/转发消息(用于发送聊天信息)
- 获取音频下载链接(
get_voice_download_url)
好友
- 获取好友列表
- 获取好友信息
- 获取好友分组列表
- 获取好友分组信息
- 撤回消息
- 发送文本信息(
send_friend_msg)
群组
- 获取群列表
- 获取群信息
- 获取群成员列表
- 发送群消息(
send_group_msg) - 发送戳一戳(
send_nudge) - 设置群管理(
set_group_admin) - 禁言群员(
mute_member) - 撤回消息(
recall_group_msg) - 漫游消息(
get_group_msg)
事件
通过注册事件监听回调,在事件发生时执行指定操作。事件类型可通过 cai.client.events 模块导入。
- 好友消息 (PrivateMessage)
- 群消息 (GroupMessage)
- 完整的群事件支持 (group.py)
- Bot 基础事件 (common.py)
- 好友事件 (friend.py)
二次开发
暂无文档,请参考 examples 中的源代码进行开发
注意:这需要你有 一定 的源代码阅读能力
分支信息
本仓库为 github.com/cscs181/CAI 的一个二次开发项目,遵循原有的开发许可证同时,不会修改原有文件内的版权信息
最后感谢 yanyongyu 开源的源码
Metadata
Release files for cai-bot 0.1.2
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 |
|---|---|---|---|---|
| cai_bot-0.1.2.tar.gz | 272.3 kB | Without provenance | Details for cai_bot-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cai_bot-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for cai_bot-0.1.2-py3-none-any.whl |
Total release size: 616.3 kB
Release files / cai_bot-0.1.2.tar.gz
| Download URL | cai_bot-0.1.2.tar.gz |
|---|---|
| Size | 272.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1ac52e871ad6b4f988be5400f4a857d2c5ddda8f72c0786b62f5ef0e94d4aefa
|
|
BLAKE2b-256 checksum How to use checksums |
075a8ee4f6b43c0c066c6cd97a2a1ef64dca00f9cc24f51723b92ba40e4082cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.7.2 CPython/3.11.3
|
Release files / cai_bot-0.1.2-py3-none-any.whl
| Download URL | cai_bot-0.1.2-py3-none-any.whl |
|---|---|
| Size | 344.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ffaf64a8067fc9aa1acb75e3db7f0a7648375a1d244fedbd231e1176b218c671
|
|
BLAKE2b-256 checksum How to use checksums |
a91f67606a2376f963fed7c08bda840b4e6035b110eadcba1fa43ff5f1af49b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.7.2 CPython/3.11.3
|
Security for cai-bot 0.1.2
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.