Overview
Request events occur when someone wants to interact with the bot, such as sending a friend request or inviting the bot to a group. Your application can approve or reject these requests programmatically.Common Fields
All request events share these fields:number
required
Unix timestamp (in seconds) when the request was made
number
required
The bot’s QQ number
string
required
Always
"request" for request eventsstring
required
Type of request:
"friend" or "group"Friend Request
Triggered when someone sends a friend request to the bot.Fields
string
required
Always
"friend"number
required
QQ number of the requester
string
required
Friend request message/comment
string
required
Request flag for identifying and processing this request
Example
Handling Friend Requests
To approve or reject a friend request, use theset_friend_add_request action:
Group Request
Triggered when someone invites the bot to join a group or requests to join a group the bot manages.Fields
string
required
Always
"group"string
required
"add"- Someone requests to join a group"invite"- Someone invites the bot to join a group
number
required
Group number
number
required
QQ number of the requester/inviter
string
required
Request message/comment
string
required
Request flag for identifying and processing this request
Example: Group Invite
Example: Join Request
Handling Group Requests
To approve or reject a group request, use theset_group_add_request action:
Complete Request Handler
Here’s a complete example that handles all request types:Quick Response
When using HTTP POST adapter, you can respond to requests directly by returning a response:Best Practices
1. Implement Whitelists and Blacklists
2. Log All Requests
3. Implement Rate Limiting
4. Send Notification After Approval
Next Steps
- Learn about Message Events
- Explore Group Actions to manage group requests
- Check User Actions for friend management
- Review Events Overview for the complete event system
