@dcrays/dcgchat-test 0.2.32 → 0.2.33

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.
Files changed (3) hide show
  1. package/index.ts +2 -0
  2. package/package.json +1 -1
  3. package/src/bot.ts +10 -4
package/index.ts CHANGED
@@ -12,6 +12,8 @@ const plugin = {
12
12
  configSchema: emptyPluginConfigSchema(),
13
13
  register(api: OpenClawPluginApi) {
14
14
  setDcgchatRuntime(api.runtime)
15
+
16
+ console.log('🚀 ~ handleDcgchatMessage ~ process.platform:', process.platform)
15
17
  monitoringToolMessage(api)
16
18
  setOpenClawConfig(api.config)
17
19
  api.registerChannel({ plugin: dcgchatPlugin })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcrays/dcgchat-test",
3
- "version": "0.2.32",
3
+ "version": "0.2.33",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for 书灵墨宝 (WebSocket)",
6
6
  "main": "index.ts",
package/src/bot.ts CHANGED
@@ -331,11 +331,17 @@ export async function handleDcgchatMessage(msg: InboundMessage, accountId: strin
331
331
  markDispatchIdle()
332
332
  if (![...systemCommand, ...interruptCommand].includes(text?.trim())) {
333
333
  for (const file of extractMobookFiles(completeText)) {
334
- let resolved = file
335
- if (!fs.existsSync(resolved)) {
336
- resolved = path.join(getWorkspaceDir(), file)
337
- if (!fs.existsSync(resolved)) return
334
+ const candidates: string[] = [file]
335
+ candidates.push(path.join(getWorkspaceDir(), file))
336
+ candidates.push(path.join(getWorkspaceDir(), file.replace(/^\//, '')))
337
+ if (process.platform === 'win32') {
338
+ const underMobook = file.replace(/^\/mobook\//i, '').replace(/^mobook[\\/]/i, '')
339
+ if (underMobook) {
340
+ candidates.push(path.join('C:\\', 'mobook', underMobook))
341
+ }
338
342
  }
343
+ const resolved = candidates.find((p) => fs.existsSync(p))
344
+ if (!resolved) continue
339
345
  await sendDcgchatMedia({ msgCtx, mediaUrl: resolved, text: '' })
340
346
  }
341
347
  }