What is OneBot 11?
OneBot 11 is a unified bot protocol standard that provides a consistent API interface for QQ bot frameworks. NapCat implements the OneBot 11 protocol, allowing you to build QQ bots using standardized actions and events.Action System
Actions are the core of OneBot 11 API - they allow you to interact with QQ by sending requests and receiving responses. Each action has:- Action Name: The identifier for the action (e.g.,
send_msg,get_group_info) - Request Parameters: Input data required by the action
- Response Data: Output data returned after execution
- Return Codes: Status codes indicating success or failure
How to Call Actions
Actions can be called through different network adapters:HTTP POST
WebSocket
Response Format
All actions return a standardized response:Response status:
ok for success, failed for failureReturn code:
0 for success, non-zero for errorsResponse data specific to each action
Error message (only present on failure)
Echo value from request (WebSocket only)
Common Error Codes
Request parameter error or business logic execution failed
Insufficient permissions
Resource not found
Bad request (HTTP)
Operation timeout or unknown error
Action Categories
NapCat organizes actions into several categories:Message Actions
Send, delete, and retrieve messages in private chats and groups. View Message Actions →Group Actions
Manage groups, members, permissions, and group settings. View Group Actions →User Actions
Get user information, friend lists, and send interactions. View User Actions →File Actions
Upload and download files in groups and private chats. View File Actions →Extended Actions
NapCat-specific extensions for advanced features like OCR, status setting, and more. View Extended Actions →Message Format
Messages in OneBot 11 can be sent in three formats:String (CQ Code)
Array (Recommended)
Single Segment
Action Name Variants
Each action supports three calling variants:action_name- Standard synchronous callaction_name_async- Asynchronous executionaction_name_rate_limited- Rate-limited execution
send_msg, send_msg_async, send_msg_rate_limited