From f06631d199bca2732cfe82e82424335193eb5374 Mon Sep 17 00:00:00 2001 From: sliverp Date: Fri, 30 Jan 2026 13:51:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E7=9B=AE=E5=BD=95=E4=B8=BA=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E4=B8=8B=E7=9A=84=20downloads?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gateway.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gateway.ts b/src/gateway.ts index e658020..9dd4f90 100644 --- a/src/gateway.ts +++ b/src/gateway.ts @@ -1,4 +1,5 @@ import WebSocket from "ws"; +import path from "node:path"; import type { ResolvedQQBotAccount, WSPayload, C2CMessageEvent, GuildMessageEvent, GroupMessageEvent } from "./types.js"; import { getAccessToken, getGatewayUrl, sendC2CMessage, sendChannelMessage, sendGroupMessage, clearTokenCache, sendC2CImageMessage, sendGroupImageMessage } from "./api.js"; import { getQQBotRuntime } from "./runtime.js"; @@ -240,7 +241,8 @@ export async function startGateway(ctx: GatewayContext): Promise { // 处理附件(图片等)- 下载到本地供 clawdbot 访问 let attachmentInfo = ""; const imageUrls: string[] = []; - const downloadDir = process.env.QQBOT_DOWNLOAD_DIR || "./qqbot-downloads"; + // 默认存到当前工作目录的 downloads 子目录(这样 clawdbot 可以访问) + const downloadDir = process.env.QQBOT_DOWNLOAD_DIR || path.join(process.cwd(), "downloads"); if (event.attachments?.length) { for (const att of event.attachments) {