Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 11, 2025

This PR implements a new adapter for the Kook platform (formerly KaiHeiLa) using the official @gehongyan/Kook.Net library, enabling HuaJiBot.NET to connect to and interact with Kook servers.

Changes Made

New Adapter Implementation

  • HuaJiBot.NET.Adapter.Kook: Complete new project implementing the Kook adapter
  • KookAdapter.cs: Main adapter class inheriting from BotServiceBase with full implementation of all required methods
  • KookCommandReader.cs: Message parser handling Kook's KMarkdown format, mentions, and replies

Core Integration

  • Configuration Support: Added ServiceType.Kook and KookConnectionInfo to the config system
  • CLI Integration: Updated App.cs to support Kook adapter initialization
  • Solution Integration: Added new project to solution file with proper dependencies

Features Implemented

  • Bot login and connection management using Kook.Net WebSocket client
  • Message receiving and event processing integrated with HuaJiBot.NET's event system
  • Text message sending with support for mentions using Kook's (met)userId(met) format
  • Message recall functionality
  • Channel name modification
  • Proper command parsing supporting text, mentions, and message replies
  • Error handling and logging throughout

Technical Details

The implementation follows the established patterns of existing adapters (OneBot, Satori):

// Configuration example
{
  "Service": "Kook",
  "Kook": {
    "Token": "your_kook_bot_token"
  }
}

// Usage follows standard pattern
var adapter = new KookAdapter(token) { Logger = logger };
await adapter.SetupServiceAsync();

The adapter properly integrates with the plugin system and supports all standard HuaJiBot.NET functionality including command processing, event handling, and plugin data management.

Dependencies

  • Kook.Net (version 0.0.45-alpha): Official Kook .NET library by @gehongyan
  • Compatible with the existing HuaJiBot.NET framework architecture

This implementation provides a solid foundation for Kook platform support and can be extended with additional features like rich embeds, voice channels, and advanced permission handling in the future.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits September 11, 2025 09:27
Co-authored-by: LazuliKao <46601807+LazuliKao@users.noreply.github.com>
Co-authored-by: LazuliKao <46601807+LazuliKao@users.noreply.github.com>
…d feedback

Co-authored-by: LazuliKao <46601807+LazuliKao@users.noreply.github.com>
Copilot AI changed the title [WIP] 增加HuaJiBot.NET.Adapter.Kook,接入@gehongyan/Kook.Net实现bot Add HuaJiBot.NET.Adapter.Kook with Kook.Net integration Sep 11, 2025
Copilot AI requested a review from LazuliKao September 11, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants