Nonebot2
跨平台 Python 异步聊天机器人框架 / Asynchronous multi-platform chatbot framework written in Python
Last verified:
What is Nonebot2?
NoneBot2 is a modern, cross-platform, and extensible Python chatbot framework based on Python's type annotations and asynchronous features. It provides convenient and flexible support for building chat bots with ease. The framework is written based on Python asyncio and includes synchronous function compatibility based on the asynchronous mechanism.
Key features include async-first architecture that handles large volumes of messages smoothly, 100% type annotation coverage for reliability, NB-CLI interactive command-line tool for easy project scaffolding, and a core plugin system for modular development and function expansion. The dependency injection system simplifies event handling and reduces code redundancy.
NoneBot2 supports multiple chat platforms through adapters including OneBot (QQ, Telegram, WeChat Official Account, KOOK), Telegram, Feishu, GitHub, QQ official API, DingTalk, Console, Red (QQ protocol), Satori, Discord, DoDo, Mirai, Ntchat (WeChat), Minecraft, BiliBili Live, Walle-Q, and Villa (MiHoyo), with many adapters contributed by the community.
The framework is designed for Python developers building chat bots, particularly those working with QQ robots, Discord bots, Telegram bots, and other messaging platforms. With over 100,000 direct and indirect users and a rich community ecosystem, users can install existing plugins without writing any code, needing only environment configuration and plugin installation.
Nonebot2 pricing
Pricing model: Freemium
Free and open-source under MIT license. No paid plans or tiers. The framework is completely free to use with no restrictions. All plugins and adapters are also free, though some community plugins may have separate licensing.
Nonebot2 pros
- Async-first architecture based on Python asyncio for high performance
- 100% type annotation coverage with Pyright/Pylance support
- NB-CLI interactive command-line tool for easy project scaffolding
- Plugin system enables modular development and easy maintenance
- Dependency injection system simplifies event handling code
- Supports 15+ chat platforms through adapters (QQ, Telegram, Discord, etc.)
- Cross-platform support (Windows, macOS, Linux)
- Compatible with multiple web frameworks (FastAPI, Quart, aiohttp, httpx, websockets)
- Large active community with over 100,000 users
- Rich ecosystem of official and third-party plugins available
- Synchronous function compatibility alongside async
- Clean and clear API design for rapid development
- MIT license for free open-source use
- Built-in dependency functions reduce user code
- Customizable communication protocols
Nonebot2 cons
- Requires Python 3.9 or higher
- Not a platform-specific implementation (features depend on adapters)
- DingTalk adapter currently unavailable (seeking maintainer)
- Many advanced adapters are community-contributed without official maintenance
- Some protocol adapters like Ntchat (WeChat) require community setup
- Not a replacement for NoneBot1 (both maintained separately)
- Documentation primarily in Chinese
- Learning curve for async programming concepts
- Plugin functionality depends on adapter support
- QQ official API has frequent adjustments requiring adapter updates
Frequently asked questions about Nonebot2
What is NoneBot2?
NoneBot2 is a modern, cross-platform, and extensible Python chatbot framework based on Python's type annotations and asynchronous features. It provides convenient and flexible support for building chat bots and handles message parsing and event processing through a plugin system.
What Python version does NoneBot2 require?
NoneBot2 only supports Python 3.9 or higher versions. You must have Python 3.9+ installed to use the framework.
How do I install NoneBot2?
Install pipx first with 'python -m pip install --user pipx', then install the scaffold with 'pipx install nb-cli', create a project with 'nb create', and run it with 'nb run'.
What platforms does NoneBot2 support?
NoneBot2 supports multiple platforms through adapters including OneBot (QQ, Telegram, WeChat Official Account, KOOK), Telegram, Feishu, GitHub, Discord, DoDo, Console, Red, Satori, Mirai, Minecraft, BiliBili Live, and more, with many adapters contributed by the community.
Do I need to write code to use NoneBot2?
No, users don't need to write any code. NoneBot2 has a large number of developers creating plugins, and users can simply complete environment configuration and install plugins to use NoneBot2 normally.
What is the plugin system?
The plugin system is the core of NoneBot2. It enables modularization and function expansion of the bot, making it convenient for maintenance and management. Plugins can be installed from the official and third-party plugin store.
What is dependency injection in NoneBot2?
Dependency injection is NoneBot2's custom system that allows code to declare what it needs (dependencies), and the system injects those dependencies. This is useful for shared logic, database connections, HTTP sessions, user permission checks, and authentication while reducing code coupling and duplication.
Is NoneBot2 a replacement for NoneBot1?
No, NoneBot2 is not a replacement for NoneBot1. Both are actively maintained. However, if you want to try new features or support more platforms, you can consider using NoneBot2.
What drivers does NoneBot2 support?
NoneBot2 supports multiple web frameworks including FastAPI (server-side), Quart (async Flask, server-side), aiohttp (client-side), httpx (client-side), and websockets (client-side), with customizable and combinable options.
Where can I find documentation and community resources?
Complete documentation is available on the NoneBot website. Community resources include the FAQ page at faq.nonebot.dev, tutorials, actual project examples, plugin store, forum at discussions.nonebot.dev, QQ group (768887710), Telegram, and Discord community.