Makabaka 1.0.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Makabaka --version 1.0.0.1
NuGet\Install-Package Makabaka -Version 1.0.0.1
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="Makabaka" Version="1.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Makabaka --version 1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Makabaka, 1.0.0.1"
#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.
// Install Makabaka as a Cake Addin #addin nuget:?package=Makabaka&version=1.0.0.1 // Install Makabaka as a Cake Tool #tool nuget:?package=Makabaka&version=1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Makabaka
简介
基于 OneBot-11标准 的、适配于 Lagrange.Onebot 的、C# .NET Standard 2.0 的异步机器人开发框架。
本项目将持续跟进 Lagrange.Core 项目进度。由于 Lagrange.Core 项目仍在开发当中,可能有部分功能暂未支持。
如果对该项目有任何问题,欢迎在 Issues 中提出。
安装
Makabaka 已发布到 Nuget ,可以通过NuGet包管理器搜索并安装到工程。
或者,可以直接去 Releases 中下载 .nupkg 文件。
已适配内容
<Details> <Summary>消息类型</Summary>
消息类型 | 是否支持 |
---|---|
Text | 🟢 |
Face | 🟢 |
Image | 🟢 |
Record | 🔴 |
Video | 🔴 |
At | 🟢 |
Rps | 🔴 |
Dice | 🔴 |
Shake | 🔴 |
Poke | 🔴 |
Anonymous | 🔴 |
Share | 🔴 |
Contact | 🔴 |
Location | 🔴 |
Music | 🔴 |
Reply | 🔴 |
Forward | 🔴 |
Node | 🔴 |
Xml | 🔴 |
Json | 🔴 |
</Details>
<Details> <Summary>API</Summary>
</Details>
<Details> <Summary>事件</Summary>
推送类型 | 事件名称 | 是否支持 |
---|---|---|
Message | Private Message | 🔴 |
Message | Group Message | 🟢 |
Notice | Group File Upload | 🔴 |
Notice | Group Admin Change | 🔴 |
Notice | Group Member Decrease | 🔴 |
Notice | Group Member Increase | 🔴 |
Notice | Group Mute | 🔴 |
Notice | Friend Add | 🔴 |
Notice | Group Recall Message | 🔴 |
Notice | Friend Recall Message | 🔴 |
Notice | Group Poke | 🔴 |
Notice | Group red envelope luck king | 🔴 |
Notice | Group Member Honor Changed | 🔴 |
Request | Add Friend Request | 🔴 |
Request | Group Request/Invitations | 🔴 |
Meta | LifeCycle | 🟢 |
Meta | Heartbeat | 🟢 |
</Details>
<Details> <Summary>适配器</Summary>
适配器类型 | 是否支持 |
---|---|
Http | 🔴 |
Http-Post | 🔴 |
ForwardWebSocket | 🟢 |
ReverseWebSocket | 🔴 |
</Details>
画饼充饥
- 添加Http-Post支持
- 添加ReverseWebSocket支持
代码示例
using Makabaka.Models.API.Responses;
using Makabaka.Models.EventArgs.Messages;
using Makabaka.Models.EventArgs.Meta;
using Makabaka.Models.Messages;
using Makabaka.Services;
using Serilog;
namespace Test
{
internal class Program
{
private static IService _service;
static async Task Main(string[] args)
{
Log.Logger = new LoggerConfiguration() // Serilog包
.MinimumLevel.Debug() // 日志等级
.WriteTo.Console() // 日志输出
.CreateLogger(); // 配置日志
_service = ServiceFactory.CreateForwardWebSocketService(new() // 创建正向WebSocket服务
{
AccessToken = "114514", // 适配器的access_token,用于认证
Host = "127.0.0.1", // 服务器地址
Port = "8080", // 服务器端口
});
// 注册事件
_service.OnLifeCycle += OnLifeCycle; // 生命周期事件
_service.OnGroupMessage += OnGroupMessage; // 群消息事件
await _service.StartAsync(); // 启动服务
await _service.WaitAsync(); // 等待服务关闭
//await _service.StopAsync(); // 关闭服务,可以放在任何地方(放这里其实没用,前面在等待服务关闭)
}
private static async void OnGroupMessage(object? sender, GroupMessageEventArgs e)
{
if (e.Message == "测试") // 接收到“测试”
{
APIResponse<MessageIdInfo> response = await e.Session.SendGroupMessageAsync(e.GroupId, new TextSegment("耶")); // 发送“耶”
response.EnsureSuccess(); // 确保发送成功了
MessageIdInfo info = response; // 这里可以隐式转换
// 因此,如果你用不到APIResponse<T>,可以把两行省略成一行:
// MessageIdInfo info = await e.Session.SendGroupMessageAsync(e.GroupId, new TextSegment("耶"));
// 效果是一样的
Log.Information($"消息ID:{info.MessageId}"); // 输出消息ID
}
}
private static async void OnLifeCycle(object? sender, LifeCycleEventArgs e)
{
LoginInfo info = await e.Session.GetLoginInfoAsync(); // 获取登录信息
Log.Information($"当前登录账号:[{info.UserId}]{info.Nickname}");
}
}
}
开源协议
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Fleck (>= 1.2.0)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 3.1.0-dev-02086)
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 |
---|---|---|
2.0.0 | 0 | 11/10/2024 |
2.0.0-preview.2.241029.1 | 37 | 10/29/2024 |
2.0.0-preview.1.241026.1 | 41 | 10/26/2024 |
1.2.1.2 | 185 | 3/29/2024 |
1.2.1.1 | 115 | 3/22/2024 |
1.2.1 | 117 | 3/13/2024 |
1.2.0.1 | 100 | 3/6/2024 |
1.2.0 | 110 | 2/28/2024 |
1.1.3 | 112 | 2/23/2024 |
1.1.2.1 | 185 | 12/24/2023 |
1.1.2 | 104 | 12/24/2023 |
1.1.1.3 | 89 | 12/23/2023 |
1.1.1.2 | 109 | 12/20/2023 |
1.1.1.1 | 151 | 11/9/2023 |
1.1.1 | 104 | 11/8/2023 |
1.1.0 | 101 | 11/4/2023 |
1.0.1 | 107 | 10/29/2023 |
1.0.0.2 | 123 | 10/29/2023 |
1.0.0.1 | 115 | 10/28/2023 |
1.0.0 | 99 | 10/28/2023 |