Explorar el Código

重定向支持

Sakulin hace 3 meses
padre
commit
b666765cd9
Se han modificado 1 ficheros con 12 adiciones y 1 borrados
  1. 12 1
      src/lib/Plugins.ts

+ 12 - 1
src/lib/Plugins.ts

@@ -512,7 +512,18 @@ async function handleCommand(context: PrivateFriendMessage | PrivateGroupMessage
                 });
             }
 
-        } else {
+        }
+
+        else if (typeof result?.redirect == "string") {
+            const targetCommand = findCommand(plugin, result.redirect);
+            if (!targetCommand) {
+                botlogger.info(`命令未找到: ${result.redirect}`);
+                return;
+            }
+            return await handleCommand(context, plugin, targetCommand, args);
+        }
+
+        else {
             // 发送普通文本响应
             const message = [...baseMessage, createTextMessage(result)];