dsh-shlr-bilitoolkit 0.1.7 → 0.1.8
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 +2 -2
- package/dist/dsh.js +451 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,8 +71,8 @@ const [ups, _] = await client.space.videos(574115689, 1, 10);
|
|
|
71
71
|
|
|
72
72
|
- 包名 `dsh-shlr-bilitoolkit`(符合 `dsh-` 前缀约定),`package.json` 里声明了 `dsh.bundle.patch: ./cordis.patch.yml`,因此会被 dsh 识别为插件而非普通库。
|
|
73
73
|
- 入口 `src/dsh.ts` 导出 `apply(ctx)`,注册一组工具(读取为主,写操作明确标注「需登录 / 谨慎」):
|
|
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` / `bili_dynamic_publish` / `bili_dynamic_repost`(均会真实修改账号状态,需登录)
|
|
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` / `bili_video_pagelist` / `bili_video_subtitles` / `bili_video_playurl` / `bili_video_status` / `bili_space_collections` / `bili_space_collection` / `bili_fav_folder_videos` / `bili_dynamic_detail` / `bili_notify_ats` / `bili_notify_likes` / `bili_message_unread` / `bili_message_history` / `bili_relation_stat` / `bili_user_following` / `bili_profile_info` / `bili_comment_replies`
|
|
75
|
+
- 写操作:`bili_like` / `bili_follow` / `bili_favorite` / `bili_send_comment` / `bili_send_message` / `bili_triple` / `bili_dynamic_publish` / `bili_dynamic_repost` / `bili_coin` / `bili_unfavorite` / `bili_fav_folder_create` / `bili_fav_folder_delete` / `bili_dynamic_like` / `bili_dynamic_delete` / `bili_comment_send` / `bili_comment_reply` / `bili_comment_delete` / `bili_message_recall` / `bili_profile_update_sign` / `bili_profile_update`(均会真实修改账号状态,需登录)
|
|
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
|
@@ -491,6 +491,457 @@ export const TOOLS = [
|
|
|
491
491
|
return { ok: true, dynamicId: id, url: `https://t.bilibili.com/${id}` };
|
|
492
492
|
},
|
|
493
493
|
},
|
|
494
|
+
// ---- 视频补充 ----
|
|
495
|
+
{
|
|
496
|
+
id: "bili_video_pagelist",
|
|
497
|
+
description: "获取视频的分 P 列表(标题 + cid),用于定位具体某一 P。",
|
|
498
|
+
parameters: {
|
|
499
|
+
type: "object",
|
|
500
|
+
properties: { bvid: { type: "string" } },
|
|
501
|
+
required: ["bvid"],
|
|
502
|
+
},
|
|
503
|
+
handler: async (a) => {
|
|
504
|
+
const pages = await (await getClient()).video.pagelist(a.bvid);
|
|
505
|
+
return pages.map((p) => p.toDict());
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
id: "bili_video_subtitles",
|
|
510
|
+
description: "列出视频可用的字幕轨(语言 / 名称 / 链接),不含正文。",
|
|
511
|
+
parameters: {
|
|
512
|
+
type: "object",
|
|
513
|
+
properties: { bvid: { type: "string" } },
|
|
514
|
+
required: ["bvid"],
|
|
515
|
+
},
|
|
516
|
+
handler: async (a) => {
|
|
517
|
+
const subs = await (await getClient()).video.subtitles(a.bvid);
|
|
518
|
+
return subs.map((s) => s.toDict());
|
|
519
|
+
},
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
id: "bili_video_playurl",
|
|
523
|
+
description: "获取视频播放地址信息(清晰度、可用清晰度列表、durl 直链)。高清晰度可能需登录 / 大会员。",
|
|
524
|
+
parameters: {
|
|
525
|
+
type: "object",
|
|
526
|
+
properties: {
|
|
527
|
+
bvid: { type: "string" },
|
|
528
|
+
page: { type: "integer", default: 1 },
|
|
529
|
+
qn: { type: "integer", default: 80 },
|
|
530
|
+
},
|
|
531
|
+
required: ["bvid"],
|
|
532
|
+
},
|
|
533
|
+
handler: async (a) => {
|
|
534
|
+
const info = await (await getClient()).video.playurl(a.bvid, Number(a.page ?? 1), undefined, Number(a.qn ?? 80));
|
|
535
|
+
return info.toDict();
|
|
536
|
+
},
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
id: "bili_video_status",
|
|
540
|
+
description: "查询我对某视频的互动状态:是否已点赞、已投硬币数。",
|
|
541
|
+
parameters: {
|
|
542
|
+
type: "object",
|
|
543
|
+
properties: { bvid: { type: "string" } },
|
|
544
|
+
required: ["bvid"],
|
|
545
|
+
},
|
|
546
|
+
handler: async (a) => {
|
|
547
|
+
const c = await getClient();
|
|
548
|
+
const [liked, coins] = await Promise.all([
|
|
549
|
+
c.interact.hasLike(a.bvid),
|
|
550
|
+
c.interact.coinsGiven(a.bvid),
|
|
551
|
+
]);
|
|
552
|
+
return { liked, coins };
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
// ---- 空间 / 合集 ----
|
|
556
|
+
{
|
|
557
|
+
id: "bili_space_collections",
|
|
558
|
+
description: "获取某 UP 主的合集 / 系列列表。",
|
|
559
|
+
parameters: {
|
|
560
|
+
type: "object",
|
|
561
|
+
properties: {
|
|
562
|
+
uid: { type: "integer" },
|
|
563
|
+
pageSize: { type: "integer", default: 20 },
|
|
564
|
+
},
|
|
565
|
+
required: ["uid"],
|
|
566
|
+
},
|
|
567
|
+
handler: async (a) => {
|
|
568
|
+
const [cols, total] = await (await getClient()).space.collections(Number(a.uid), 1, Number(a.pageSize ?? 20));
|
|
569
|
+
return { total, collections: cols.map((c) => c.toDict()) };
|
|
570
|
+
},
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
id: "bili_space_collection",
|
|
574
|
+
description: "获取某个合集内的视频列表。",
|
|
575
|
+
parameters: {
|
|
576
|
+
type: "object",
|
|
577
|
+
properties: {
|
|
578
|
+
seasonId: { type: "integer" },
|
|
579
|
+
mid: { type: "integer", description: "UP 主 uid(可选,用于正确 Referer)" },
|
|
580
|
+
pageSize: { type: "integer", default: 30 },
|
|
581
|
+
},
|
|
582
|
+
required: ["seasonId"],
|
|
583
|
+
},
|
|
584
|
+
handler: async (a) => {
|
|
585
|
+
const [col, videos, total] = await (await getClient()).space.collection(Number(a.seasonId), 1, Number(a.pageSize ?? 30), a.mid != null ? Number(a.mid) : undefined);
|
|
586
|
+
return { collection: col.toDict(), total, videos: videos.map((v) => v.toDict()) };
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
// ---- 收藏夹 ----
|
|
590
|
+
{
|
|
591
|
+
id: "bili_fav_folder_videos",
|
|
592
|
+
description: "获取某个收藏夹内的视频列表(需登录)。",
|
|
593
|
+
parameters: {
|
|
594
|
+
type: "object",
|
|
595
|
+
properties: {
|
|
596
|
+
folderId: { type: "integer" },
|
|
597
|
+
order: { type: "string", enum: ["mtime", "view", "pubtime"], default: "mtime" },
|
|
598
|
+
pageSize: { type: "integer", default: 20 },
|
|
599
|
+
},
|
|
600
|
+
required: ["folderId"],
|
|
601
|
+
},
|
|
602
|
+
handler: async (a) => {
|
|
603
|
+
const [videos, total] = await (await getClient()).interact.folderVideos(Number(a.folderId), 1, Number(a.pageSize ?? 20), a.order ?? "mtime");
|
|
604
|
+
return { total, videos: videos.map((v) => v.toDict()) };
|
|
605
|
+
},
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
id: "bili_fav_folder_create",
|
|
609
|
+
description: "新建收藏夹(写操作,需登录)。",
|
|
610
|
+
parameters: {
|
|
611
|
+
type: "object",
|
|
612
|
+
properties: {
|
|
613
|
+
title: { type: "string" },
|
|
614
|
+
privacy: { type: "integer", enum: [0, 1], default: 0, description: "0 公开 / 1 私密" },
|
|
615
|
+
},
|
|
616
|
+
required: ["title"],
|
|
617
|
+
},
|
|
618
|
+
handler: async (a) => {
|
|
619
|
+
const id = await (await getClient()).interact.createFolder(String(a.title ?? ""), Number(a.privacy ?? 0));
|
|
620
|
+
return { ok: true, folderId: id };
|
|
621
|
+
},
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
id: "bili_fav_folder_delete",
|
|
625
|
+
description: "删除收藏夹(写操作,需登录,谨慎)。",
|
|
626
|
+
parameters: {
|
|
627
|
+
type: "object",
|
|
628
|
+
properties: { folderId: { type: "integer" } },
|
|
629
|
+
required: ["folderId"],
|
|
630
|
+
},
|
|
631
|
+
handler: async (a) => {
|
|
632
|
+
await (await getClient()).interact.deleteFolder(Number(a.folderId));
|
|
633
|
+
return { ok: true };
|
|
634
|
+
},
|
|
635
|
+
},
|
|
636
|
+
// ---- 互动写操作补充 ----
|
|
637
|
+
{
|
|
638
|
+
id: "bili_coin",
|
|
639
|
+
description: "给视频投币(写操作,需登录,硬币每日有限且不可退回)。",
|
|
640
|
+
parameters: {
|
|
641
|
+
type: "object",
|
|
642
|
+
properties: {
|
|
643
|
+
bvid: { type: "string" },
|
|
644
|
+
count: { type: "integer", enum: [1, 2], default: 1 },
|
|
645
|
+
alsoLike: { type: "boolean", default: false },
|
|
646
|
+
},
|
|
647
|
+
required: ["bvid"],
|
|
648
|
+
},
|
|
649
|
+
handler: async (a) => {
|
|
650
|
+
await (await getClient()).interact.coin(a.bvid, undefined, Number(a.count ?? 1), Boolean(a.alsoLike ?? false));
|
|
651
|
+
return { ok: true };
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
id: "bili_unfavorite",
|
|
656
|
+
description: "把视频从收藏夹移除(写操作,需登录)。",
|
|
657
|
+
parameters: {
|
|
658
|
+
type: "object",
|
|
659
|
+
properties: {
|
|
660
|
+
bvid: { type: "string" },
|
|
661
|
+
folderName: { type: "string", description: "收藏夹名(可选,默认取默认收藏夹)" },
|
|
662
|
+
},
|
|
663
|
+
required: ["bvid"],
|
|
664
|
+
},
|
|
665
|
+
handler: async (a) => {
|
|
666
|
+
const fid = await (await getClient()).interact.unfavorite(a.bvid, undefined, a.folderName);
|
|
667
|
+
return { ok: true, folderId: fid };
|
|
668
|
+
},
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
id: "bili_user_following",
|
|
672
|
+
description: "查询我是否已关注某用户。",
|
|
673
|
+
parameters: {
|
|
674
|
+
type: "object",
|
|
675
|
+
properties: { uid: { type: "integer" } },
|
|
676
|
+
required: ["uid"],
|
|
677
|
+
},
|
|
678
|
+
handler: async (a) => ({
|
|
679
|
+
following: await (await getClient()).interact.isFollowing(Number(a.uid)),
|
|
680
|
+
}),
|
|
681
|
+
},
|
|
682
|
+
// ---- 动态补充 ----
|
|
683
|
+
{
|
|
684
|
+
id: "bili_dynamic_detail",
|
|
685
|
+
description: "获取单条动态详情(正文、类型、统计数据等)。",
|
|
686
|
+
parameters: {
|
|
687
|
+
type: "object",
|
|
688
|
+
properties: { dynamicId: { type: "string" } },
|
|
689
|
+
required: ["dynamicId"],
|
|
690
|
+
},
|
|
691
|
+
handler: async (a) => (await (await getClient()).dynamic.detail(a.dynamicId)).toDict(),
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
id: "bili_dynamic_like",
|
|
695
|
+
description: "点赞或取消点赞一条动态(写操作,需登录)。",
|
|
696
|
+
parameters: {
|
|
697
|
+
type: "object",
|
|
698
|
+
properties: {
|
|
699
|
+
dynamicId: { type: "string" },
|
|
700
|
+
liked: { type: "boolean", default: true },
|
|
701
|
+
},
|
|
702
|
+
required: ["dynamicId"],
|
|
703
|
+
},
|
|
704
|
+
handler: async (a) => {
|
|
705
|
+
await (await getClient()).dynamic.thumb(a.dynamicId, Boolean(a.liked ?? true));
|
|
706
|
+
return { ok: true };
|
|
707
|
+
},
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
id: "bili_dynamic_delete",
|
|
711
|
+
description: "删除自己发布的一条动态(写操作,需登录,谨慎)。",
|
|
712
|
+
parameters: {
|
|
713
|
+
type: "object",
|
|
714
|
+
properties: { dynamicId: { type: "string" } },
|
|
715
|
+
required: ["dynamicId"],
|
|
716
|
+
},
|
|
717
|
+
handler: async (a) => {
|
|
718
|
+
await (await getClient()).dynamic.delete(a.dynamicId);
|
|
719
|
+
return { ok: true };
|
|
720
|
+
},
|
|
721
|
+
},
|
|
722
|
+
// ---- 评论(动态 / 专栏 / 楼中楼 / 回复 / 删除) ----
|
|
723
|
+
{
|
|
724
|
+
id: "bili_comment_send",
|
|
725
|
+
description: "在视频 / 动态 / 专栏下发表评论(写操作,需登录)。视频用 bvid,动态用动态 id,专栏用 cv 号 / 链接。",
|
|
726
|
+
parameters: {
|
|
727
|
+
type: "object",
|
|
728
|
+
properties: {
|
|
729
|
+
target: { type: "string", enum: ["video", "dynamic", "article"], default: "video" },
|
|
730
|
+
id: { type: "string", description: "视频 bvid / 动态 id / 专栏 cv 号或链接" },
|
|
731
|
+
message: { type: "string" },
|
|
732
|
+
},
|
|
733
|
+
required: ["id", "message"],
|
|
734
|
+
},
|
|
735
|
+
handler: async (a) => {
|
|
736
|
+
const c = await getClient();
|
|
737
|
+
const message = String(a.message ?? "");
|
|
738
|
+
const target = String(a.target ?? "video");
|
|
739
|
+
let comment;
|
|
740
|
+
if (target === "video")
|
|
741
|
+
comment = await c.comment.sendVideo(a.id, message);
|
|
742
|
+
else if (target === "dynamic")
|
|
743
|
+
comment = await c.comment.sendDynamic(a.id, message);
|
|
744
|
+
else if (target === "article")
|
|
745
|
+
comment = await c.comment.sendArticle(a.id, message);
|
|
746
|
+
else
|
|
747
|
+
throw new Error("target 只支持 video / dynamic / article");
|
|
748
|
+
return comment.toDict();
|
|
749
|
+
},
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
id: "bili_comment_replies",
|
|
753
|
+
description: "获取某条评论下的楼中楼回复列表。",
|
|
754
|
+
parameters: {
|
|
755
|
+
type: "object",
|
|
756
|
+
properties: {
|
|
757
|
+
target: { type: "string", enum: ["video", "dynamic", "article"], default: "video" },
|
|
758
|
+
id: { type: "string" },
|
|
759
|
+
rootRpid: { type: "integer", description: "根评论 rpid" },
|
|
760
|
+
pageSize: { type: "integer", default: 20 },
|
|
761
|
+
},
|
|
762
|
+
required: ["id", "rootRpid"],
|
|
763
|
+
},
|
|
764
|
+
handler: async (a) => {
|
|
765
|
+
const c = await getClient();
|
|
766
|
+
const target = String(a.target ?? "video");
|
|
767
|
+
const root = Number(a.rootRpid);
|
|
768
|
+
const ps = Number(a.pageSize ?? 20);
|
|
769
|
+
let items;
|
|
770
|
+
if (target === "video")
|
|
771
|
+
[items] = await c.comment.repliesVideo(a.id, root, 1, ps);
|
|
772
|
+
else if (target === "dynamic")
|
|
773
|
+
[items] = await c.comment.repliesDynamic(a.id, root, 1, ps);
|
|
774
|
+
else if (target === "article")
|
|
775
|
+
[items] = await c.comment.repliesArticle(a.id, root, 1, ps);
|
|
776
|
+
else
|
|
777
|
+
throw new Error("target 只支持 video / dynamic / article");
|
|
778
|
+
return { replies: items.map((x) => x.toDict()) };
|
|
779
|
+
},
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
id: "bili_comment_reply",
|
|
783
|
+
description: "回复某条评论(楼中楼,写操作,需登录)。",
|
|
784
|
+
parameters: {
|
|
785
|
+
type: "object",
|
|
786
|
+
properties: {
|
|
787
|
+
target: { type: "string", enum: ["video", "dynamic", "article"], default: "video" },
|
|
788
|
+
id: { type: "string" },
|
|
789
|
+
rootRpid: { type: "integer" },
|
|
790
|
+
message: { type: "string" },
|
|
791
|
+
parentRpid: { type: "integer", description: "被回复的评论 rpid(可选,默认同 rootRpid)" },
|
|
792
|
+
},
|
|
793
|
+
required: ["id", "rootRpid", "message"],
|
|
794
|
+
},
|
|
795
|
+
handler: async (a) => {
|
|
796
|
+
const c = await getClient();
|
|
797
|
+
const target = String(a.target ?? "video");
|
|
798
|
+
const root = Number(a.rootRpid);
|
|
799
|
+
const parent = a.parentRpid != null ? Number(a.parentRpid) : root;
|
|
800
|
+
const message = String(a.message ?? "");
|
|
801
|
+
let comment;
|
|
802
|
+
if (target === "video")
|
|
803
|
+
comment = await c.comment.replyVideo(a.id, root, message, parent);
|
|
804
|
+
else if (target === "dynamic")
|
|
805
|
+
comment = await c.comment.sendDynamic(a.id, message, root, parent);
|
|
806
|
+
else if (target === "article")
|
|
807
|
+
comment = await c.comment.sendArticle(a.id, message, root, parent);
|
|
808
|
+
else
|
|
809
|
+
throw new Error("target 只支持 video / dynamic / article");
|
|
810
|
+
return comment.toDict();
|
|
811
|
+
},
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
id: "bili_comment_delete",
|
|
815
|
+
description: "删除自己发表的评论(写操作,需登录,谨慎)。",
|
|
816
|
+
parameters: {
|
|
817
|
+
type: "object",
|
|
818
|
+
properties: {
|
|
819
|
+
target: { type: "string", enum: ["video", "dynamic", "article"], default: "video" },
|
|
820
|
+
id: { type: "string" },
|
|
821
|
+
rpid: { type: "integer" },
|
|
822
|
+
},
|
|
823
|
+
required: ["id", "rpid"],
|
|
824
|
+
},
|
|
825
|
+
handler: async (a) => {
|
|
826
|
+
const c = await getClient();
|
|
827
|
+
const target = String(a.target ?? "video");
|
|
828
|
+
const rpid = Number(a.rpid);
|
|
829
|
+
if (target === "video")
|
|
830
|
+
await c.comment.deleteVideo(a.id, rpid);
|
|
831
|
+
else if (target === "dynamic")
|
|
832
|
+
await c.comment.deleteDynamic(a.id, rpid);
|
|
833
|
+
else if (target === "article")
|
|
834
|
+
await c.comment.deleteArticle(a.id, rpid);
|
|
835
|
+
else
|
|
836
|
+
throw new Error("target 只支持 video / dynamic / article");
|
|
837
|
+
return { ok: true };
|
|
838
|
+
},
|
|
839
|
+
},
|
|
840
|
+
// ---- 消息中心补充 ----
|
|
841
|
+
{
|
|
842
|
+
id: "bili_notify_ats",
|
|
843
|
+
description: "获取「@我的」消息列表(需登录)。",
|
|
844
|
+
parameters: { type: "object", properties: {} },
|
|
845
|
+
handler: async () => {
|
|
846
|
+
const [items, , isEnd] = await (await getClient()).notify.ats();
|
|
847
|
+
return { isEnd, notices: items.map((x) => x.toDict()) };
|
|
848
|
+
},
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
id: "bili_notify_likes",
|
|
852
|
+
description: "获取「收到的赞」列表(需登录)。",
|
|
853
|
+
parameters: { type: "object", properties: {} },
|
|
854
|
+
handler: async () => {
|
|
855
|
+
const [items, , isEnd] = await (await getClient()).notify.likes();
|
|
856
|
+
return { isEnd, notices: items.map((x) => x.toDict()) };
|
|
857
|
+
},
|
|
858
|
+
},
|
|
859
|
+
// ---- 私信补充 ----
|
|
860
|
+
{
|
|
861
|
+
id: "bili_message_unread",
|
|
862
|
+
description: "获取私信未读数(需登录)。",
|
|
863
|
+
parameters: { type: "object", properties: {} },
|
|
864
|
+
handler: async () => (await getClient()).message.unread(),
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
id: "bili_message_history",
|
|
868
|
+
description: "获取与某用户的私信聊天记录(需登录)。",
|
|
869
|
+
parameters: {
|
|
870
|
+
type: "object",
|
|
871
|
+
properties: {
|
|
872
|
+
talkerUid: { type: "integer" },
|
|
873
|
+
size: { type: "integer", default: 20 },
|
|
874
|
+
},
|
|
875
|
+
required: ["talkerUid"],
|
|
876
|
+
},
|
|
877
|
+
handler: async (a) => {
|
|
878
|
+
const msgs = await (await getClient()).message.history(Number(a.talkerUid), Number(a.size ?? 20));
|
|
879
|
+
return { messages: msgs.map((m) => m.toDict()) };
|
|
880
|
+
},
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
id: "bili_message_recall",
|
|
884
|
+
description: "撤回一条已发送的私信(写操作,需登录,通常有时限)。",
|
|
885
|
+
parameters: {
|
|
886
|
+
type: "object",
|
|
887
|
+
properties: {
|
|
888
|
+
receiverUid: { type: "integer" },
|
|
889
|
+
msgKey: { type: "integer" },
|
|
890
|
+
},
|
|
891
|
+
required: ["receiverUid", "msgKey"],
|
|
892
|
+
},
|
|
893
|
+
handler: async (a) => {
|
|
894
|
+
await (await getClient()).message.recall(Number(a.receiverUid), Number(a.msgKey));
|
|
895
|
+
return { ok: true };
|
|
896
|
+
},
|
|
897
|
+
},
|
|
898
|
+
// ---- 关注统计 ----
|
|
899
|
+
{
|
|
900
|
+
id: "bili_relation_stat",
|
|
901
|
+
description: "获取某用户的关注数 / 粉丝数统计。",
|
|
902
|
+
parameters: {
|
|
903
|
+
type: "object",
|
|
904
|
+
properties: { uid: { type: "integer" } },
|
|
905
|
+
required: ["uid"],
|
|
906
|
+
},
|
|
907
|
+
handler: async (a) => (await getClient()).relation.stat(Number(a.uid)),
|
|
908
|
+
},
|
|
909
|
+
// ---- 个人资料 ----
|
|
910
|
+
{
|
|
911
|
+
id: "bili_profile_info",
|
|
912
|
+
description: "获取我的个人资料(昵称、等级、硬币、签名等,需登录)。",
|
|
913
|
+
parameters: { type: "object", properties: {} },
|
|
914
|
+
handler: async () => (await getClient()).profile.info(),
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
id: "bili_profile_update_sign",
|
|
918
|
+
description: "修改我的个性签名(写操作,需登录,会进入审核)。",
|
|
919
|
+
parameters: {
|
|
920
|
+
type: "object",
|
|
921
|
+
properties: { sign: { type: "string" } },
|
|
922
|
+
required: ["sign"],
|
|
923
|
+
},
|
|
924
|
+
handler: async (a) => {
|
|
925
|
+
await (await getClient()).profile.updateSign(String(a.sign ?? ""));
|
|
926
|
+
return { ok: true };
|
|
927
|
+
},
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
id: "bili_profile_update",
|
|
931
|
+
description: "修改我的昵称 / 性别 / 生日(写操作,需登录,至少改一项)。",
|
|
932
|
+
parameters: {
|
|
933
|
+
type: "object",
|
|
934
|
+
properties: {
|
|
935
|
+
uname: { type: "string", description: "新昵称(1~20 字符)" },
|
|
936
|
+
sex: { type: "string", enum: ["男", "女", "保密"] },
|
|
937
|
+
birthday: { type: "string", description: "YYYY-MM-DD" },
|
|
938
|
+
},
|
|
939
|
+
},
|
|
940
|
+
handler: async (a) => {
|
|
941
|
+
await (await getClient()).profile.updateProfile(a.uname != null ? String(a.uname) : undefined, a.sex != null ? String(a.sex) : undefined, a.birthday != null ? String(a.birthday) : undefined);
|
|
942
|
+
return { ok: true };
|
|
943
|
+
},
|
|
944
|
+
},
|
|
494
945
|
// ---- 登录状态 ----
|
|
495
946
|
{
|
|
496
947
|
id: "bili_login_status",
|