Step-by-Step Guide to Building a QQ Bot with Mirai, Python, and Mirai-Console-Loader
This tutorial walks you through setting up the Mirai ecosystem, using mirai-console-loader, handling slider verification with mirai-login-solver-selenium, configuring mirai-api-http, installing OpenJDK, and finally developing a QQ bot in Python with graia-application-mirai, complete with code examples and troubleshooting tips.
The article begins with an overview of the Mirai ecosystem, explaining that the core consists of the Mirai framework, mirai-core, and mirai-core-api, and introduces mirai-console as a convenient wrapper for plugin development.
It then describes how to launch mirai-console using the one‑click starter mirai-console-loader (mcl) , detailing the download, extraction, and command‑line execution steps, as well as fixing a common configuration error.
Next, the guide addresses the slider verification problem during QQ login and recommends using mirai-login-solver-selenium . It provides a step‑by‑step process for downloading the appropriate ChromeDriver, renaming it, and placing it in the correct directory.
The tutorial proceeds to configure mirai-api-http by placing the downloaded JAR into the plugins folder and editing the setting.yml file (shown in a code block) to set the authKey, enable WebSocket, and define host and port.
When a signature verification error occurs, the article explains that replacing Oracle JDK with OpenJDK resolves the issue, and it outlines how to download, install, and add OpenJDK to the system PATH.
After the backend setup, the guide shifts to Python development. It instructs installing the Python client library with pip install graia-application-mirai and provides a complete bot.py example that connects to the Mirai HTTP API, listens for friend messages, and replies with "Hello, World!".
Finally, the article advises testing the bot by sending a message from QQ and confirms successful operation with a screenshot, then concludes by encouraging readers to explore the official Mirai documentation for deeper API knowledge.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.