Makabaka 1.0.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Makabaka --version 1.0.0.2
NuGet\Install-Package Makabaka -Version 1.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="Makabaka" Version="1.0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Makabaka --version 1.0.0.2
#r "nuget: Makabaka, 1.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.
// Install Makabaka as a Cake Addin
#addin nuget:?package=Makabaka&version=1.0.0.2

// Install Makabaka as a Cake Tool
#tool nuget:?package=Makabaka&version=1.0.0.2

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>

API 是否支持
/send_private_msg 🟢
/send_group_msg 🟢
/send_msg 🔴
/delete_msg 🔴
/get_msg 🔴
/get_forward_msg 🔴
/send_like 🔴
/set_group_kick 🟢
/set_group_ban 🟢
/set_group_anonymous_ban 🔴
/set_group_whole_ban 🟢
/set_group_admin 🟢
/set_group_anonymous 🔴
/set_group_card 🟢
/set_group_name 🟢
/set_group_leave 🟢
/set_group_special_title 🔴
/set_friend_add_request 🔴
/set_group_add_request 🔴
/get_login_info 🟢
/get_stranger_info 🔴
/get_friend_list 🔴
/get_group_info 🟢
/get_group_list 🟢
/get_group_member_info 🔴
/get_group_member_list 🔴
/get_group_honor_info 🔴
/get_cookies 🔴
/get_csrf_token 🔴
/get_credentials 🔴
/get_record 🔴
/get_image 🔴
/can_send_image 🔴
/can_send_record 🔴
/get_status 🔴
/get_version_info 🟢
/set_restart 🔴
/clean_cache 🔴

</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}");
        }
    }
}

开源协议

GPL-3.0 license

Product 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.

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.2.1.2 107 3/29/2024
1.2.1.1 97 3/22/2024
1.2.1 89 3/13/2024
1.2.0.1 77 3/6/2024
1.2.0 88 2/28/2024
1.1.3 94 2/23/2024
1.1.2.1 162 12/24/2023
1.1.2 87 12/24/2023
1.1.1.3 73 12/23/2023
1.1.1.2 91 12/20/2023
1.1.1.1 128 11/9/2023
1.1.1 82 11/8/2023
1.1.0 90 11/4/2023
1.0.1 89 10/29/2023
1.0.0.2 102 10/29/2023
1.0.0.1 95 10/28/2023
1.0.0 88 10/28/2023