Actions19
Overview
This node integrates with the OneBot API to manage group-related operations in messaging platforms that support OneBot. Specifically, the "禁言群成员" (Ban Group Member) operation allows you to mute one or more members within a managed group for a specified duration. This is useful for moderators or group administrators who want to temporarily restrict certain members from sending messages in the group.
Practical scenarios include:
- Automatically muting disruptive users during events.
- Temporarily banning spammers or rule violators.
- Managing group behavior by controlling member permissions dynamically.
Properties
| Name | Meaning |
|---|---|
| Group Name or ID | Select the target group from a list of groups where the bot has management rights, or specify an ID via expression. |
| 成员 Names or IDs | Select one or more members of the chosen group to be banned (muted). |
| Ban Duration (Seconds) | Duration of the ban in seconds; 0 means unban (remove mute). Default is 1800 seconds (30 minutes). |
Output
The node outputs JSON data representing the result of the ban operation. The structure typically includes success status and any error messages if the operation fails. The output corresponds to the response from the OneBot API after attempting to set the ban on the specified group members.
No binary data output is involved in this operation.
Dependencies
- Requires connection to a OneBot-compatible messaging platform.
- Needs an API key credential configured in n8n to authenticate requests to the OneBot API.
- The bot must have administrative or owner privileges in the target group to perform ban operations.
- The node uses internal helper methods to fetch lists of manageable groups and their members dynamically.
Troubleshooting
Common Issues:
- Attempting to ban members in a group where the bot lacks admin/owner rights will fail.
- Specifying invalid or non-existent group or user IDs will cause errors.
- Providing a negative ban duration or non-numeric values may lead to unexpected behavior.
Error Messages:
- "Failed to get login info" or "Failed to get managed group list": Indicates authentication issues or insufficient permissions.
- "Unknown resource type": Occurs if the resource parameter is incorrect.
- API errors returned from OneBot will be included in the output JSON under an error field.
Resolutions:
- Ensure the bot account has proper admin or owner roles in the group.
- Verify group and member IDs are correct and accessible.
- Use valid numeric values for the ban duration, with 0 to cancel bans.
Links and References
- OneBot API Documentation
- n8n Expressions Documentation
- OneBot GitHub Repository (for source and further details)