@dcrays/dcgchat-test 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/bot.ts +6 -4
- package/src/channel.ts +3 -2
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { resolveAccount } from "./channel.js";
|
|
|
8
8
|
import { setMsgStatus } from "./tool.js";
|
|
9
9
|
import mime from "mime-types"
|
|
10
10
|
|
|
11
|
-
const targetPath = path.join(os.homedir(), '
|
|
11
|
+
const targetPath = path.join(os.homedir(), '../');
|
|
12
12
|
|
|
13
13
|
type MediaInfo = {
|
|
14
14
|
path: string;
|
|
@@ -126,19 +126,21 @@ export async function handleDcgchatMessage(params: {
|
|
|
126
126
|
|
|
127
127
|
const envelopeOptions = core.channel.reply.resolveEnvelopeFormatOptions(cfg);
|
|
128
128
|
// const messageBody = `${userId}: ${text}`;
|
|
129
|
+
// 补充消息
|
|
130
|
+
const supplementMessage = `\n<br/> 如果有文件生成,直接将文件生成到 ${targetPath}/upload 目录下,并将文件发送给我,如果没有生成文件请忽略`;
|
|
129
131
|
const messageBody = text;
|
|
130
132
|
const bodyFormatted = core.channel.reply.formatAgentEnvelope({
|
|
131
133
|
channel: "书灵墨宝",
|
|
132
134
|
from: userId,
|
|
133
135
|
timestamp: new Date(),
|
|
134
136
|
envelope: envelopeOptions,
|
|
135
|
-
body: messageBody,
|
|
137
|
+
body: messageBody + supplementMessage,
|
|
136
138
|
});
|
|
137
139
|
|
|
138
140
|
const ctxPayload = core.channel.reply.finalizeInboundContext({
|
|
139
141
|
Body: bodyFormatted,
|
|
140
|
-
RawBody: text,
|
|
141
|
-
CommandBody: text,
|
|
142
|
+
RawBody: text + supplementMessage,
|
|
143
|
+
CommandBody: text + supplementMessage,
|
|
142
144
|
From: userId,
|
|
143
145
|
To: userId,
|
|
144
146
|
SessionKey: route.sessionKey,
|
package/src/channel.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { copyFile, mkdir, rename, unlink } from "node:fs/promises";
|
|
2
2
|
import { basename, dirname, isAbsolute, relative, resolve } from "node:path";
|
|
3
|
-
import
|
|
3
|
+
import os from "node:os";
|
|
4
4
|
import type { ChannelPlugin, OpenClawConfig } from "openclaw/plugin-sdk";
|
|
5
5
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk";
|
|
6
6
|
import type { ResolvedDcgchatAccount, DcgchatConfig } from "./types.js";
|
|
@@ -8,7 +8,8 @@ import { logDcgchat } from "./log.js";
|
|
|
8
8
|
import { getWsConnection } from "./connection.js";
|
|
9
9
|
import { getMsgParams } from "./tool.js";
|
|
10
10
|
|
|
11
|
-
const uploadRoot = resolve('
|
|
11
|
+
const uploadRoot = resolve(os.homedir(), '../', "upload");
|
|
12
|
+
logDcgchat.info(`uploadRoot: ${uploadRoot}`);
|
|
12
13
|
|
|
13
14
|
function isPathInside(parentPath: string, targetPath: string): boolean {
|
|
14
15
|
const relativePath = relative(parentPath, targetPath);
|