PlugBotSharp.Api 0.0.2

dotnet add package PlugBotSharp.Api --version 0.0.2
                    
NuGet\Install-Package PlugBotSharp.Api -Version 0.0.2
                    
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="PlugBotSharp.Api" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PlugBotSharp.Api" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="PlugBotSharp.Api" />
                    
Project file
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 PlugBotSharp.Api --version 0.0.2
                    
#r "nuget: PlugBotSharp.Api, 0.0.2"
                    
#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 PlugBotSharp.Api@0.0.2
                    
#: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=PlugBotSharp.Api&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=PlugBotSharp.Api&version=0.0.2
                    
Install as a Cake Tool

PlugBotSharp.Api

组件开发用的 API 包:插件、代理、运行库只引用这个包,不引用宿主。

  • 组件接口:IBasePlugin、IBaseProxy、IProxyInstasnce、IBaseLib、IComponent
  • 消息模型:BaseMessage 及文本、图片、Markdown、卡片、引用、直通、事件等类型
  • 注册与句柄:IRegister、SendHandle、RaiseHandle、ProxyEventHandle、状态句柄
  • 面板:ConfigMap、IPanelView、IRawMessageView
  • 宿主能力:ComponentApi、CertStore

安装

dotnet add package PlugBotSharp.Api --version 1.0.0

组件工程还需要引用 PlugBotSharp.MetaGen(构建工具包),由它读取 Meta.cs 生成 Meta.json 并打包成组件 zip。

使用

public class PluginMain : IBasePlugin
{
    public bool Init(string path) => true;
    public bool Load() => true;
    public bool Unload() => true;
    public bool Enable() => true;
    public bool Disable() => true;
    public void Reload() { }
    public Dictionary<string, ConfigMap> ConfigMap() => new();
    public void UpdateMap(Dictionary<string, ConfigMap> data) { }

    public void RegisterEventHook(IRegister register)
    {
        register.SubscribeMessage(message =>
            message.Message is TextMessage text ? [new TextMessage("收到:" + text.Text)] : []);
    }
}

教程见仓库 docs/ 目录,组件清单和打包见 docs/reference/package.md。

目标框架

  • net10.0
  • 依赖 Microsoft.AspNetCore.App 共享框架和 NLog,组件运行在宿主进程里,不需要自己启动服务

许可

MIT,见仓库根目录 LICENSE-MIT。

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.
  • net10.0

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
0.0.2 55 12/3/2026