From 3ef3efa8fe95ffcf39f0a9dbec1590727e6918e2 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Sun, 23 Nov 2025 15:33:18 +0800 Subject: [PATCH] docs: add comments on name=* matching in plugin command --- docs/en/plugin/dev/components/command.md | 1 + docs/zh/plugin/dev/components/command.md | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/en/plugin/dev/components/command.md b/docs/en/plugin/dev/components/command.md index e9eddb4fb..1f22c9815 100644 --- a/docs/en/plugin/dev/components/command.md +++ b/docs/en/plugin/dev/components/command.md @@ -130,6 +130,7 @@ In this code, the `send` function is registered as a subcommand through the `@se - `!info` matches the subcommand with name="" - `!info field` matches the subcommand with name="field" - `!info field value` matches the subcommand with name="field", with `value` as the subcommand parameter +- Specialy, `name="*"` matches all unmatched first-level subcommands, and passes each section after `info` as parameters, for example `!info 123`, `!info abc`. You can get `['123']` or `['abc']` from `context.crt_params`, depending on the user's input. In subcommand functions, you can read command parameters through the `context` variable. diff --git a/docs/zh/plugin/dev/components/command.md b/docs/zh/plugin/dev/components/command.md index fb8a95181..d2b699074 100644 --- a/docs/zh/plugin/dev/components/command.md +++ b/docs/zh/plugin/dev/components/command.md @@ -130,6 +130,7 @@ class Info(Command): - `!info` 匹配 name="" 的子命令 - `!info field` 匹配 name="field" 的子命令 - `!info field value` 匹配 name="field" 的子命令,`value` 为子命令参数 +- 特殊地,`name="*"` 匹配所有未匹配的一级子命令,并将`info`后的每一节作为参数传递传递参数,例如`!info 123`, `!info abc`. 此时可以从`context.crt_params`中获取到`['123']`或`['abc']`,取决于用户输入的参数。 子命令函数中,可通过 `context` 变量读取到命令参数。