YzjSdk 1.0.0
dotnet add package YzjSdk --version 1.0.0
NuGet\Install-Package YzjSdk -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YzjSdk" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="YzjSdk" Version="1.0.0" />
<PackageReference Include="YzjSdk" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add YzjSdk --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: YzjSdk, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package YzjSdk@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=YzjSdk&version=1.0.0
#tool nuget:?package=YzjSdk&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
YzjSdk — 云之家机器人 C# SDK
用于与云之家(Yunzhijia)智能机器人 API 交互的 C# SDK,支持消息收发。
功能
- 发送消息 — 通过
YzjClient向指定用户或群组发送文本消息,支持引用回复 - Webhook 接收消息 — 通过
YzjWebhookHandler处理云之家推送的 HTTP 回调,支持 HmacSHA1 签名验证,可直接挂载到 ASP.NET Core 端点 - WebSocket 接收消息 — 通过
YzjWebSocketClient建立长连接实时接收消息,内置心跳检测(15s)、断线自动重连(指数退避)、消息分类(业务消息 / 控制帧) - 签名工具 —
YzjSignature提供 HmacSHA1 签名计算与验证,防止请求伪造
项目结构
csharp/
├── YzjSdk/ # SDK 类库
│ ├── YzjClient.cs # 发送消息客户端
│ ├── YzjWebhookHandler.cs # Webhook 接收处理器
│ ├── YzjWebSocketClient.cs# WebSocket 长连接客户端
│ ├── YzjMessage.cs # 消息模型定义
│ └── YzjSignature.cs # 签名验证工具
└── YzjSdk.Example/ # 控制台示例项目
└── Program.cs # 完整使用示例
快速开始
环境要求
- .NET 8.0 或更高版本
构建
dotnet build csharp/YzjSdk/YzjSdk.csproj
运行示例
# 可选:通过环境变量设置机器人 URL
export YZJ_SEND_MSG_URL="https://www.yunzhijia.com/robot/send?yzjtoken=YOUR_TOKEN"
dotnet run --project csharp/YzjSdk.Example
启动后可选择三种模式:发送消息、WebSocket 接收、Webhook 接收。
完整用法请参考 YzjSdk.Example/Program.cs。
配置说明
SDK 核心配置项为 sendMsgUrl,即云之家机器人管理后台提供的发送消息 URL,格式如:
https://www.yunzhijia.com/robot/send?yzjtoken=<你的token>
WebSocket 地址会从该 URL 自动推导,无需额外配置。
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 117 | 6/8/2026 |