koishi-plugin-bilibili-notify 2.0.0-alpha.1 → 2.0.0-alpha.10

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/lib/biliAPI.d.ts CHANGED
@@ -36,6 +36,7 @@ declare class BiliAPI extends Service {
36
36
  getAllDynamic(updateBaseline?: string): Promise<any>;
37
37
  hasNewDynamic(updateBaseline: string): Promise<any>;
38
38
  follow(fid: string): Promise<any>;
39
+ getRelationGroupDetail(tagid: string): Promise<any>;
39
40
  getCookieInfo(refreshToken: string): Promise<any>;
40
41
  getUserInfo(mid: string): Promise<any>;
41
42
  getWbiKeys(): Promise<{
package/lib/biliAPI.js CHANGED
@@ -40,6 +40,7 @@ const CREATE_GROUP = 'https://api.bilibili.com/x/relation/tag/create';
40
40
  const MODIFY_GROUP_MEMBER = 'https://api.bilibili.com/x/relation/tags/addUsers';
41
41
  const GET_ALL_GROUP = 'https://api.bilibili.com/x/relation/tags';
42
42
  const COPY_USER_TO_GROUP = 'https://api.bilibili.com/x/relation/tags/copyUsers';
43
+ const GET_RELATION_GROUP_DETAIL = 'https://api.bilibili.com/x/relation/tag';
43
44
  class BiliAPI extends koishi_1.Service {
44
45
  static inject = ['database', 'notifier'];
45
46
  jar;
@@ -240,6 +241,15 @@ class BiliAPI extends koishi_1.Service {
240
241
  throw new Error('网络异常,本次请求失败!');
241
242
  }
242
243
  }
244
+ async getRelationGroupDetail(tagid) {
245
+ try {
246
+ const { data } = await this.client.get(`${GET_RELATION_GROUP_DETAIL}?tagid=${tagid}`);
247
+ return data;
248
+ }
249
+ catch (e) {
250
+ throw new Error('网络异常,本次请求失败!');
251
+ }
252
+ }
243
253
  // Check if Token need refresh
244
254
  async getCookieInfo(refreshToken) {
245
255
  try {
@@ -1,10 +1,20 @@
1
- import { Bot, Context, Logger, Schema, Session } from "koishi";
1
+ import { Bot, Context, FlatPick, Logger, Schema, Session } from "koishi";
2
2
  import { Notifier } from "@koishijs/plugin-notifier";
3
+ import { LoginBili } from "./database";
4
+ type ChannelIdArr = Array<{
5
+ channelId: string;
6
+ atAll: boolean;
7
+ }>;
8
+ type TargetItem = {
9
+ channelIdArr: ChannelIdArr;
10
+ platform: string;
11
+ };
12
+ type Target = Array<TargetItem>;
3
13
  type SubItem = {
4
14
  id: number;
5
15
  uid: string;
6
16
  roomId: string;
7
- targetIdArr: Array<string>;
17
+ target: Target;
8
18
  platform: string;
9
19
  live: boolean;
10
20
  dynamic: boolean;
@@ -13,6 +23,7 @@ type SubItem = {
13
23
  type SubManager = Array<SubItem>;
14
24
  declare class ComRegister {
15
25
  static inject: string[];
26
+ qqRelatedBotList: Array<string>;
16
27
  logger: Logger;
17
28
  config: ComRegister.Config;
18
29
  loginTimer: Function;
@@ -20,44 +31,50 @@ declare class ComRegister {
20
31
  rebootCount: number;
21
32
  subNotifier: Notifier;
22
33
  subManager: SubManager;
23
- bot: Bot<Context>;
34
+ loginDBData: FlatPick<LoginBili, "dynamic_group_id">;
35
+ privateBot: Bot<Context>;
24
36
  dynamicDispose: Function;
25
- sendMsgFunc: (guild: string, content: any) => Promise<void>;
37
+ sendMsgFunc: (bot: Bot<Context, any>, channelId: string, content: any) => Promise<void>;
26
38
  constructor(ctx: Context, config: ComRegister.Config);
39
+ splitMultiPlatformStr(str: string): Target;
40
+ getBot(ctx: Context, pf: string): Bot<Context, any>;
27
41
  sendPrivateMsg(content: string): Promise<void>;
28
42
  sendPrivateMsgAndRebootService(ctx: Context): Promise<void>;
29
43
  sendPrivateMsgAndStopService(ctx: Context): Promise<void>;
30
- sendMsg(targets: Array<string>, content: any): Promise<void>;
44
+ sendMsg(ctx: Context, targets: Target, content: any, live?: boolean): Promise<void>;
31
45
  dynamicDetect(ctx: Context): () => Promise<void>;
32
46
  debug_dynamicDetect(ctx: Context): () => Promise<void>;
33
- liveDetect(ctx: Context, roomId: string, guildId: Array<string>): () => Promise<void>;
47
+ liveDetect(ctx: Context, roomId: string, target: Target): () => Promise<void>;
34
48
  subShow(): string;
35
- checkIfNeedSub(liveSub: boolean, dynamicSub: boolean, session: Session, data?: any): Promise<Array<boolean>>;
49
+ checkIfNeedSub(liveSub: boolean, dynamicSub: boolean, session: Session, liveRoomData: any): Promise<Array<boolean>>;
36
50
  updateSubNotifier(ctx: Context): void;
37
51
  checkIfLoginInfoIsLoaded(ctx: Context): Promise<unknown>;
52
+ subUserInBili(ctx: Context, mid: string): Promise<{
53
+ flag: boolean;
54
+ msg: string;
55
+ }>;
38
56
  getSubFromDatabase(ctx: Context): Promise<void>;
39
57
  unsubSingle(ctx: Context, id: string, type: number): string;
40
- checkIfUserThatIsSubDynAndUnsub(): void;
58
+ checkIfUserIsTheLastOneWhoSubDyn(): void;
41
59
  unsubAll(ctx: Context, uid: string): void;
42
60
  checkIfIsLogin(ctx: Context): Promise<boolean>;
43
61
  }
44
62
  declare namespace ComRegister {
45
63
  interface Config {
46
- platform: string;
47
64
  master: {
48
65
  enable: boolean;
66
+ platform: string;
49
67
  masterAccount: string;
50
68
  masterAccountGuildId: string;
51
69
  };
52
70
  unlockSubLimits: boolean;
53
71
  automaticResend: boolean;
54
72
  changeMasterInfoApi: boolean;
55
- liveStartAtAll: boolean;
56
73
  restartPush: boolean;
57
- pushUrl: boolean;
58
74
  pushTime: number;
59
75
  liveLoopTime: number;
60
76
  customLiveStart: string;
77
+ customLive: string;
61
78
  customLiveEnd: string;
62
79
  dynamicUrl: boolean;
63
80
  dynamicLoopTime: number;