dsh-shlr-bilitoolkit 0.1.6 → 0.1.7
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/README.md +1 -1
- package/dist/dsh.js +47 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ const [ups, _] = await client.space.videos(574115689, 1, 10);
|
|
|
72
72
|
- 包名 `dsh-shlr-bilitoolkit`(符合 `dsh-` 前缀约定),`package.json` 里声明了 `dsh.bundle.patch: ./cordis.patch.yml`,因此会被 dsh 识别为插件而非普通库。
|
|
73
73
|
- 入口 `src/dsh.ts` 导出 `apply(ctx)`,注册一组工具(读取为主,写操作明确标注「需登录 / 谨慎」):
|
|
74
74
|
- 读取:`bili_recommend` / `bili_video_detail` / `bili_video_subtitle` / `bili_search_video` / `bili_search_user` / `bili_space_info` / `bili_space_videos` / `bili_article_view` / `bili_article_list` / `bili_dynamic_feed` / `bili_dynamic_space` / `bili_comment_list` / `bili_relation_followings` / `bili_relation_followers` / `bili_notify_unread` / `bili_notify_replies` / `bili_fav_folders`
|
|
75
|
-
- 写操作:`bili_like` / `bili_follow` / `bili_favorite` / `bili_send_comment` / `bili_send_message` / `bili_triple`(均会真实修改账号状态,需登录)
|
|
75
|
+
- 写操作:`bili_like` / `bili_follow` / `bili_favorite` / `bili_send_comment` / `bili_send_message` / `bili_triple` / `bili_dynamic_publish` / `bili_dynamic_repost`(均会真实修改账号状态,需登录)
|
|
76
76
|
- 辅助:`bili_login_status`(查登录态)/ `bili_gen_qr`(生成扫码登录二维码)/ `bili_cache_clear`(清空本地缓存)
|
|
77
77
|
- 工具读取 `BILI_COOKIE_FILE`(默认 `bili_cookies.json`)作为登录态。
|
|
78
78
|
- **扫码登录(独立获取 Cookie)**:运行 `npm run login`,终端会打印 ASCII 二维码,用「哔哩哔哩」App 扫码并确认后,Cookie 自动写入 `bili_cookies.json`。也可在对话里先调 `bili_login_status` 查登录态、调 `bili_gen_qr` 拿二维码链接与可直接展示的 `ascii` 二维码。写操作(点赞 / 收藏 / 投币 / 关注 / 评论 / 私信 / 三连)都依赖该 Cookie 中的 `SESSDATA` / `bili_jct`。
|
package/dist/dsh.js
CHANGED
|
@@ -444,6 +444,53 @@ export const TOOLS = [
|
|
|
444
444
|
},
|
|
445
445
|
handler: async (a) => (await getClient()).interact.triple(a.bvid, Number(a.coinCount ?? 2)),
|
|
446
446
|
},
|
|
447
|
+
// ---- 动态(写操作,需登录,会公开展示在主页) ----
|
|
448
|
+
{
|
|
449
|
+
id: "bili_dynamic_publish",
|
|
450
|
+
description: "发布一条文字动态(写操作,需登录,会公开展示在你的主页)。返回动态 id 与链接。",
|
|
451
|
+
parameters: {
|
|
452
|
+
type: "object",
|
|
453
|
+
properties: {
|
|
454
|
+
content: { type: "string", description: "动态正文文字内容" },
|
|
455
|
+
atUids: {
|
|
456
|
+
type: "string",
|
|
457
|
+
description: "要 @ 的用户 uid,多个用逗号分隔(可选)",
|
|
458
|
+
},
|
|
459
|
+
closeComment: {
|
|
460
|
+
type: "boolean",
|
|
461
|
+
default: false,
|
|
462
|
+
description: "是否关闭评论",
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
required: ["content"],
|
|
466
|
+
},
|
|
467
|
+
handler: async (a) => {
|
|
468
|
+
const c = await getClient();
|
|
469
|
+
const atUids = String(a.atUids ?? "")
|
|
470
|
+
.split(/[,,\s]+/)
|
|
471
|
+
.map((s) => Number(s.trim()))
|
|
472
|
+
.filter((n) => Number.isFinite(n) && n > 0);
|
|
473
|
+
const id = await c.dynamic.publish(String(a.content ?? ""), atUids, undefined, Boolean(a.closeComment ?? false));
|
|
474
|
+
return { ok: true, dynamicId: id, url: `https://t.bilibili.com/${id}` };
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
id: "bili_dynamic_repost",
|
|
479
|
+
description: "转发一条动态(写操作,需登录)。返回新动态 id 与链接。",
|
|
480
|
+
parameters: {
|
|
481
|
+
type: "object",
|
|
482
|
+
properties: {
|
|
483
|
+
dynamicId: { type: "string", description: "被转发的动态 id" },
|
|
484
|
+
content: { type: "string", description: "转发时附言(可选)" },
|
|
485
|
+
},
|
|
486
|
+
required: ["dynamicId"],
|
|
487
|
+
},
|
|
488
|
+
handler: async (a) => {
|
|
489
|
+
const c = await getClient();
|
|
490
|
+
const id = await c.dynamic.repost(a.dynamicId, String(a.content ?? ""));
|
|
491
|
+
return { ok: true, dynamicId: id, url: `https://t.bilibili.com/${id}` };
|
|
492
|
+
},
|
|
493
|
+
},
|
|
447
494
|
// ---- 登录状态 ----
|
|
448
495
|
{
|
|
449
496
|
id: "bili_login_status",
|