GraiaX Documentation
website·Indexed 32 days ago
https://graiax.cnA comprehensive guide for building bots using the Graia community ecosystem. It covers the installation and configuration of Mirai, Python environments, and IDEs, alongside detailed tutorials on using Graia Saya for modular bot development, message chain handling, and message parsing with tools like Alconna and Twilight. The documentation also introduces community projects such as GraiaX Playwright, GraiaX TextToImage, and Saya Util.
What's inside GraiaX
- Ariadne is a Python QQ automation framework based on Mirai API HTTP v2. It is a sub-project of the Graia Project. While other frameworks like Application Mirai (deprecated) and Avilla (WIP) exist within the project, Ariadne is the primary framework used for current development.
Overview of Basic Message Chain Parsers
Basic message chain parsers are located ingraia.ariadne.message.parser.base. They are used to detect specific patterns in aMessageChainand can be used as decorators to trigger event handlers only when a match is found.Overview of Twilight message matching in Ariadne
Twilight is a standard message chain matching tool used in Ariadne (specifically version ^0.7.0). It acts as a Dispatcher (inheriting fromBaseDispatcher); when used in aListenerSchema, it parses the incoming message chain. If the matching fails, it throws anExecutionStoperror, preventing the registered handler function from being called.Introduction to BroadcastControl (BCC)
BroadcastControl (BCC) is used for constructing user interfaces and event broadcasting in Ariadne. It relies on two primary elements:
- Dispatcher: Parameter parsers (e.g., event listeners and message chain parsers).
- Decorator: Parameter decorators.
Any class instance that declares a
Dispatchercan be used as an event broadcast. All predefined Ariadne events are located ingraia.ariadne.event.Overview of Graia Saya modular framework
Graia Saya is a modular management framework for Graia Ariadne bots. It allows developers to split bot functionality into separate modules (files or folders), making the codebase easier to maintain and allowing features to be added or removed by simply copying and pasting files.Overview of Graia Scheduler
Graia Scheduler is a simple, asyncio-based scheduled task library designed for ease of use and clean code integration within GraiaX bot projects.Overview of the Ariadne Framework
Ariadne is a sub-project of the Graia Project. It is an elegant and complete Python QQ automation framework based on the Mirai API HTTP v2. It serves as the primary framework used in the Graia community for building QQ bots.Overview of Git and Version Control Systems (VCS)
Git is a Version Control System (VCS) used to manage code changes. It allows developers to take snapshots of their project (known as Commits), enabling them to track modifications, compare changes, and revert to previous states. This prevents loss of work when experimental changes introduce bugs.Overview of Graia Community Projects
The Graia Community provides several officially released projects for developers, including specialized integrations for FastAPI, Playwright, and image generation tools.Overview of Graia and community projects
The Graia ecosystem includes several key projects for plugin management, configuration, and utility integration:
- Saya: A plugin (module) manager specifically for Graia.
- Kayaku: A comprehensive configuration file solution.
- GraiaX FastAPI: A utility for calling FastAPI directly within Saya modules.
- GraiaX Playwright: A boundary tool that starts Playwright upon Graia project launch and allows direct calls within Saya modules.
- GraiaX Text2Img Playwright: A tool that converts text-based formats like HTML and Markdown into images using Playwright.
Understand the Ariadne and Mirai architecture
Ariadne does not connect to QQ servers directly. It requires a specific stack to function:
- Mirai: A high-performance QQ protocol library.
- Mirai Console: A plugin-based development platform based on Mirai.
- Mirai Api Http (mah): A Mirai Console plugin that provides the HTTP interface for Ariadne to communicate with Mirai.
- Mirai Console Loader: The launcher for Mirai and Mirai Console.
To use Ariadne, you must first configure Mirai's automatic login and the
mirai-api-httpplugin.Understand the Ariadne and Mirai Architecture
Ariadne does not connect to QQ servers directly. It requires a specific stack to function:
- Mirai: A high-performance QQ protocol library.
- Mirai Console: A plugin-based extensible development platform based on Mirai.
- Mirai Api Http (mah): A Mirai Console plugin that provides the interaction layer between Ariadne and Mirai.
- Mirai Console Loader: The launcher for Mirai and Mirai Console.
To use Ariadne, you must first configure Mirai's automatic login and the
mirai-api-httpplugin.