瀏覽代碼

重定向支持

Sakulin 3 月之前
父節點
當前提交
b666765cd9
共有 1 個文件被更改,包括 12 次插入1 次删除
  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)];