OneBot-api icon

OneBot-api

Consume OneBot API

Overview

This node integrates with the OneBot API to manage group chat settings and actions. Specifically, for the "群组" (Group) resource and the "全员禁言" (Set Group Whole Ban) operation, it enables or disables a whole-group mute feature. This means that all members in the specified group can be muted simultaneously, preventing them from sending messages.

Common scenarios where this node is beneficial include:

  • Moderating group chats during announcements or events where only admins should speak.
  • Temporarily muting all members to prevent spam or disruptive behavior.
  • Quickly toggling group-wide communication restrictions without muting individual members.

Practical example:

  • An admin wants to mute everyone in a large group chat during an important announcement. They use this node to enable the whole-group ban, ensuring no one else can send messages until the ban is lifted.

Properties

Name Meaning
Group Name or ID Select the target group from a list of manageable groups or specify its ID via expression.
Enable Ban Boolean flag to enable (true) or disable (false) the whole group ban (mute).

Output

The node outputs JSON data representing the result of the API call to set the whole group ban status. The output typically includes success or error information returned by the OneBot API.

No binary data output is involved in this operation.

Example output JSON structure might look like:

{
  "success": true,
  "data": {
    "group_id": 123456,
    "whole_ban_enabled": true
  }
}

or in case of failure:

{
  "success": false,
  "error": "Insufficient permissions to set whole group ban"
}

Dependencies

  • Requires connection to a OneBot API endpoint with appropriate credentials (an API key or token).
  • The user must have administrative or owner privileges in the target group to perform the whole group ban operation.
  • The node uses internal helper methods to fetch manageable groups where the bot has sufficient permissions.

Troubleshooting

  • Common issues:

    • Insufficient permissions: The bot or user account may not have admin or owner rights in the group, causing the operation to fail.
    • Invalid group ID: Specifying a group ID that the bot does not manage or does not exist will cause errors.
    • Network or API errors: Connectivity issues or API downtime can lead to request failures.
  • Error messages and resolutions:

    • "Insufficient permissions": Ensure the bot account is an admin or owner of the group.
    • "Failed to get managed group list": Check API connectivity and credentials; verify the bot is logged in.
    • "Unknown resource type": Confirm the resource parameter is correctly set to "group".
    • General API errors: Review API response details and logs for specific causes.

Links and References

Discussion