SaltyQQChat

Scalable QQ-Bot Built on QQAPI

API
information
management

Installation command

!!MCDR plugin install salty_qq_chat

Author

Synced at

...

Last update

...

Latest version

Total downloads

41

Back to catalogue

SaltyQQChat

SaltyQQChat

✨🎉 An Extensible QQ Bot Plugin Powered by QQAPI! 🎉✨

Warning


Due to the f**king Tencent, the development of this plugin is temporarily suspended. The new version will be released as a web-based bot.
All new features will be updated, but no availability is promised for any feature.
If you decide to use it, testing is on you.

Introduction

This is a QQ bot plugin based on QQAPI, essentially a reworked version of QQChat. It removes many features that I consider unnecessary and optimizes the code structure.

Additionally, it supports simple bot extension through API calls, allowing you to add your own custom commands!

New features compared to QQChat include:

  • Supports ignoring commands from specific users via /bot-ban and /bot-pardon
  • Allows the bot to execute more Minecraft native commands without using /command (such as /ban, /pardon)
  • Allows starting and stopping the server through the bot
  • Supports replying when the bot is mentioned, instead of just responding to a command
  • Supports executing QQ bot commands within Minecraft
  • Check bot status via /ping and /info commands
  • [Development Feature] Remote plugin reload via /reload
  • Customizable one-way/two-way MC <==> QQ group forwarding
  • Easily extendable command tree based on regular expressions
  • Automatically handle group join requests, friend requests, and group invitations.
  • Verify if the Minecraft player exists when binding to a player.

Removed or modified features:

  • No "management group", "main group", or "message sync group" functionality. Instead, it uses multi-group synchronization (though typically, only one group is used)
  • No "MultiServer" feature, as it leads to unpredictable bugs and has limited use
  • Permissions are added to the !!qq command to prevent misuse, as CQ codes are not escaped, potentially allowing the bot account to send inappropriate content
  • Spacing added between Chinese, numbers, and English, with a more humorous tone in the responses

Installation

Install via MCDR

Use !!MCDR plugin install salty_qq_chat in the MCDR console, then !!MCDR confirm.

Install via Release

Download the corresponding .mcdr file from the Releases page and place it in the plugins folder, then reload the plugin.

Install via Source Code

Run git clone https://github.com/SALTWOOD/SaltyQQChat or git clone [email protected]:SALTWOOD/SaltyQQChat in the plugins folder, then reload the plugin.

API

One of the most interesting features of this plugin is that you can extend it by adding custom commands via other MCDR plugins. Here's an example of a single-file plugin:

from mcdreforged.api.types import PluginServerInterface
from typing import Callable, List
import re

reply: Callable
PLUGIN_METADATA = {
    'id': 'sqc_extension',
    'version': '1.0.0',
    'name': 'SQC extension plugin',
    'description': 'SaltyQQChat\'s extension plugin',
    'author': 'NONE',
    'link': 'https://github.com',
    'dependencies': {
        'salty_qq_chat': '>=1.0.0'
    }
}

def on_load(server: PluginServerInterface, old):
    global reply
    sqc = server.get_plugin_instance("salty_qq_chat")
    qqapi = server.get_plugin_instance("qq_api")

    reply = sqc.reply

    sqc.commands.add_command(re.compile(r'/your-command (.*)'), [str], handler)

def handler(server: PluginServerInterface, event, command: List[str],
            event_type):
    message = command[0]
    reply(
        event,
        f"[CQ:at,qq={event.user_id}] You provided the parameter: \"{message}\""
    )

Special Thanks

  • QQAPI - Provides a WebSocket interface to CQHttp
  • SALTWO∅D server members - For helping me test the bot and discovering security vulnerabilities before the release

Introduction source: README-EN.md