Koishi Bot Framework
website·Indexed 30 days ago
https://koishi.js.org/A modular bot framework featuring a powerful command system, plugin architecture, and multi-bot support. It provides comprehensive APIs for message sending and receiving (Sender/Receiver), database support (MySQL, SQLite, Memory), and a variety of official plugins for NLP, scheduling, and third-party integrations like GitHub and GitLab webhooks.
What's inside Koishi
- The database object in Koishi acts as a proxy for all database access associated with the application instance bound to the context. It supports an injection mechanism, allowing any plugin to define its own custom methods on the database object. While Koishi provides a standard set of official interfaces, these are implemented by the specific database adapter being used rather than by Koishi core.
Overview of koishi-plugin-chess features
v3The
koishi-plugin-chessplugin enables board game functionality within Koishi. It currently supports the following rules: Gomoku (五子棋), Go (围棋 - prohibits identical board states, does not currently support point counting), and Othello/Reversi (黑白棋).Key capabilities include:
- State Persistence: Automatically saves game states if a database is installed, allowing games to resume after a bot restart.
- Visual Rendering: Supports both text-based and image-based board displays. To enable image rendering, the
koishi-plugin-puppeteerplugin must be installed.
Overview of koishi-plugin-chat functionality
v3The
koishi-plugin-chatplugin provides three primary capabilities for bot management and debugging:- Command Line Integration: Continuously receives messages and streams them to the command line.
- WebUI Chat Page: Adds a 'Chat' page to the WebUI, allowing developers to send and receive messages directly using the bot's account.
- WebUI Sandbox Page: Adds a 'Sandbox' page featuring a virtual bot, which is used for testing and debugging new bot features without affecting production accounts.
Overview of koishi-plugin-common
v1Thekoishi-plugin-commonplugin provides a set of basic utility features and commands. It is installed by default when using thekoishilibrary.Overview of Koishi Assets API
The Assets API (
ctx.assets) allows developers to transform resource message segments into permanent links. This is critical for messages stored long-term (e.g., in dialogue plugins or GitHub integrations) because some platform-provided resource links are temporary or account-specific.Note:
ctx.assetsis NOT a built-in service. You must install a provider plugin to use it. Official providers include:@koishijs/plugin-assets-git@koishijs/plugin-assets-local@koishijs/plugin-assets-remote@koishijs/plugin-assets-s3
Overview of Koishi Database operations
TheDatabaseobject acts as a proxy for all database access associated with the Koishi context application instance. It supports an injection feature allowing plugins to define their own custom database methods. While Koishi provides a standard interface, the actual implementation of these methods is handled by the specific database driver being used.Overview of koishi-adapter-onebot and License Warning
v3The
koishi-adapter-onebotplugin allows Koishi to connect to chat bot application interface standards based on OneBot (formerly CQHTTP), primarily used for QQ bots. Recommended implementations includego-cqhttp,cqhttp-mirai, andcoolq-http-api.CRITICAL LICENSE WARNING: While Koishi is MIT licensed, most OneBot frameworks use the AGPL 3.0 license. Using this adapter may subject your bot's code to AGPL 3.0 restrictions, requiring you to open-source your code under the same license.
Overview of the Koishi Console
The Koishi Console is a graphical user interface (GUI) that encapsulates most of Koishi's core management functions. It allows developers and users to perform the following tasks without manual configuration files:
- Install plugins
- Configure bot settings
- Simulate chat interactions
- Monitor system status
- Manage databases
Overview of Koishi Robot Framework
v3Koishi is a cross-platform robot framework based on Node.js. It provides a modular architecture consisting of high-level interaction layers (commands, sessions, middleware), middle-layer control (applications, contexts, plugins), and low-level robot adapters.Overview of Koishi Official Plugins
v1Koishi provides a variety of official plugins distributed across different repositories based on their complexity and purpose. These include core plugins bundled with the main framework, standalone plugins with their own repositories, and a collection of smaller utility plugins.Overview of koishi-plugin-tools
v3Thekoishi-plugin-toolsplugin is a collection of small utility features. All provided utilities are implemented as sub-commands of thetoolscommand. Individual utilities can be enabled or disabled via the plugin configuration.Overview of koishi-plugin-chat functionality
The
koishi-plugin-chatplugin provides three primary capabilities:- Continuous message reception and forwarding to the command line.
- A 'Chat' page in the WebUI for directly receiving and sending messages using the bot's account.
- A 'Sandbox' page in the WebUI featuring a virtual bot for debugging and testing new features.