dsh-qq-moony 0.9.1 → 0.9.2
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/CHANGELOG.md +4 -0
- package/index.js +54 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 0.9.2 — 2026-10-25(本地,未发布)
|
|
2
|
+
|
|
3
|
+
- **新增 `qq_qzone_history`**:发过的说说记在本地账本 `<DSH_HOME>/qq-moony/qzone.jsonl`(时间 / tid / 正文),可以按条数翻。不读空间接口。
|
|
4
|
+
- 为什么只记账不读空间:NapCat 只提供「发说说 / 删说说」两个接口,读动态、点赞、评论一律"不支持的 Api"。要真读,得另扫码登空间网页版,那条通道脆且容易触风控。
|
|
1
5
|
# CHANGELOG
|
|
2
6
|
|
|
3
7
|
## 0.9.1 — 2026-10-25
|
package/index.js
CHANGED
|
@@ -165,7 +165,8 @@ export function apply(ctx, 配置) {
|
|
|
165
165
|
const c = { ...默认配置, ...(配置 ?? {}), ...读取本地配置() };
|
|
166
166
|
const 账本 = join(家目录(), 'sent.log');
|
|
167
167
|
const 收件箱 = join(家目录(), 'inbox.jsonl');
|
|
168
|
-
const 轮次账 = join(家目录(), 'rounds.log');
|
|
168
|
+
const 轮次账 = join(家目录(), 'rounds.log');
|
|
169
|
+
const 说说账 = join(家目录(), 'qzone.jsonl');
|
|
169
170
|
|
|
170
171
|
ctx.logger?.info?.(`qq-moony: 接到 ${c.baseUrl}(限额 ${c.perHour}/时、${c.perDay}/天)`);
|
|
171
172
|
|
|
@@ -1252,6 +1253,50 @@ export function apply(ctx, 配置) {
|
|
|
1252
1253
|
}),
|
|
1253
1254
|
);
|
|
1254
1255
|
|
|
1256
|
+
// ---------- qq_qzone_history ----------
|
|
1257
|
+
ctx.effect(() =>
|
|
1258
|
+
ctx.tools.register({
|
|
1259
|
+
name: 'qq_qzone_history',
|
|
1260
|
+
name_display: '说说账本',
|
|
1261
|
+
description:
|
|
1262
|
+
'看自己发过哪些说说(本地账本,不读空间接口)。返回时间、内容和条数。',
|
|
1263
|
+
parameters: {
|
|
1264
|
+
type: 'object',
|
|
1265
|
+
properties: {
|
|
1266
|
+
count: { type: 'number', description: '要几条,默认 10' },
|
|
1267
|
+
},
|
|
1268
|
+
additionalProperties: false,
|
|
1269
|
+
},
|
|
1270
|
+
output: 工具输出({ lines: { type: 'array', items: { type: 'string' } } }, (v) => {
|
|
1271
|
+
if (!v.ok) return `读不到:${v.reason ?? '未知原因'}`;
|
|
1272
|
+
if (!v.lines || v.lines.length === 0) return '这个账本还是空的——还没发过说说。';
|
|
1273
|
+
return v.lines.join('\n');
|
|
1274
|
+
}),
|
|
1275
|
+
async execute(args) {
|
|
1276
|
+
const 数量 = Math.min(Math.max(Number(args?.count ?? 10), 1), 50);
|
|
1277
|
+
try {
|
|
1278
|
+
if (!existsSync(说说账)) return { ok: true, lines: [] };
|
|
1279
|
+
const 行 = readFileSync(说说账, 'utf8')
|
|
1280
|
+
.split('\n')
|
|
1281
|
+
.filter(Boolean)
|
|
1282
|
+
.slice(-数量)
|
|
1283
|
+
.reverse()
|
|
1284
|
+
.map((s) => {
|
|
1285
|
+
try {
|
|
1286
|
+
const x = JSON.parse(s);
|
|
1287
|
+
return `${x.t.slice(0, 16).replace('T', ' ')}|${x.content.replace(/\n/g, ' ')}`;
|
|
1288
|
+
} catch {
|
|
1289
|
+
return s;
|
|
1290
|
+
}
|
|
1291
|
+
});
|
|
1292
|
+
return { ok: true, lines: 行 };
|
|
1293
|
+
} catch (e) {
|
|
1294
|
+
return { ok: false, lines: [], reason: e.message };
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
}),
|
|
1298
|
+
);
|
|
1299
|
+
|
|
1255
1300
|
// ---------- qq_qzone ----------
|
|
1256
1301
|
ctx.effect(() =>
|
|
1257
1302
|
ctx.tools.register({
|
|
@@ -1275,7 +1320,14 @@ export function apply(ctx, 配置) {
|
|
|
1275
1320
|
try {
|
|
1276
1321
|
const r = await 调('send_qzone_msg', { content: 正文 });
|
|
1277
1322
|
记账(账本, 'qzone', 正文);
|
|
1278
|
-
|
|
1323
|
+
const tid = String(r.data?.tid ?? '');
|
|
1324
|
+
try {
|
|
1325
|
+
mkdirSync(家目录(), { recursive: true });
|
|
1326
|
+
appendFileSync(说说账, JSON.stringify({ t: new Date().toISOString(), tid, content: 正文 }) + '\n', 'utf8');
|
|
1327
|
+
} catch {
|
|
1328
|
+
/* 记账失败不影响发出去 */
|
|
1329
|
+
}
|
|
1330
|
+
return { ok: true, tid };
|
|
1279
1331
|
} catch (e) {
|
|
1280
1332
|
return { ok: false, tid: '', reason: e.message };
|
|
1281
1333
|
}
|