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.

Tokens
125.4K
Snippets
714
Records
1.1K
Agent score
50%

What's inside Koishi

  1. Overview of Koishi Database Access

    v1
    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.
  2. Overview of koishi-plugin-chess features

    v3

    The koishi-plugin-chess plugin 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-puppeteer plugin must be installed.
  3. Overview of koishi-plugin-chat functionality

    v3

    The koishi-plugin-chat plugin provides three primary capabilities for bot management and debugging:

    1. Command Line Integration: Continuously receives messages and streams them to the command line.
    2. WebUI Chat Page: Adds a 'Chat' page to the WebUI, allowing developers to send and receive messages directly using the bot's account.
    3. 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.
  4. 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.assets is 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
  5. Overview of Koishi Database operations

    The Database object 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.
  6. Overview of koishi-adapter-onebot and License Warning

    v3

    The koishi-adapter-onebot plugin allows Koishi to connect to chat bot application interface standards based on OneBot (formerly CQHTTP), primarily used for QQ bots. Recommended implementations include go-cqhttp, cqhttp-mirai, and coolq-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.

  7. 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
  8. Overview of Koishi Robot Framework

    v3
    Koishi 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.
  9. Overview of Koishi Official Plugins

    v1
    Koishi 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.
  10. Overview of koishi-plugin-tools

    v3
    The koishi-plugin-tools plugin is a collection of small utility features. All provided utilities are implemented as sub-commands of the tools command. Individual utilities can be enabled or disabled via the plugin configuration.
  11. Overview of koishi-plugin-chat functionality

    The koishi-plugin-chat plugin provides three primary capabilities:

    1. Continuous message reception and forwarding to the command line.
    2. A 'Chat' page in the WebUI for directly receiving and sending messages using the bot's account.
    3. A 'Sandbox' page in the WebUI featuring a virtual bot for debugging and testing new features.