@luckylillia-dev/plugin-onebot11 1.0.3 → 1.1.0

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 (177) hide show
  1. package/lib/api.js +110 -0
  2. package/lib/api.js.map +7 -0
  3. package/lib/chunk-DYMW7N7M.js +24193 -0
  4. package/lib/chunk-DYMW7N7M.js.map +7 -0
  5. package/lib/index.js +411 -16844
  6. package/lib/index.js.map +4 -4
  7. package/lib/types/action/go-cqhttp/QuickOperation.d.ts +19 -0
  8. package/lib/types/action/index.d.ts +2 -0
  9. package/lib/types/action/llbot/system/GetEvent.d.ts +21 -0
  10. package/lib/types/adapter.d.ts +29 -0
  11. package/lib/types/api.d.ts +2 -0
  12. package/lib/types/config.d.ts +30 -64
  13. package/lib/types/connect/http.d.ts +43 -0
  14. package/lib/types/connect/ws.d.ts +47 -0
  15. package/lib/types/eventfilter.d.ts +2 -0
  16. package/lib/types/helper/eventForHttp.d.ts +6 -0
  17. package/lib/types/helper/quickOperation.d.ts +27 -0
  18. package/lib/types/index.d.ts +7 -7
  19. package/lib/types/protocol/action/BaseAction.d.ts +20 -0
  20. package/lib/types/protocol/action/OB11Response.d.ts +6 -0
  21. package/lib/types/protocol/action/file/GetFile.d.ts +39 -0
  22. package/lib/types/protocol/action/file/GetImage.d.ts +5 -0
  23. package/lib/types/protocol/action/file/GetRecord.d.ts +26 -0
  24. package/lib/types/protocol/action/go-cqhttp/CreateGroupFileFolder.d.ts +24 -0
  25. package/lib/types/protocol/action/go-cqhttp/DeleteEssenceMsg.d.ts +15 -0
  26. package/lib/types/protocol/action/go-cqhttp/DeleteFriend.d.ts +15 -0
  27. package/lib/types/protocol/action/go-cqhttp/DeleteGroupFile.d.ts +21 -0
  28. package/lib/types/protocol/action/go-cqhttp/DeleteGroupFolder.d.ts +18 -0
  29. package/lib/types/protocol/action/go-cqhttp/DownloadFile.d.ts +27 -0
  30. package/lib/types/protocol/action/go-cqhttp/GetForwardMsg.d.ts +25 -0
  31. package/lib/types/protocol/action/go-cqhttp/GetGroupAtAllRemain.d.ts +24 -0
  32. package/lib/types/protocol/action/go-cqhttp/GetGroupEssence.d.ts +24 -0
  33. package/lib/types/protocol/action/go-cqhttp/GetGroupFileSystemInfo.d.ts +26 -0
  34. package/lib/types/protocol/action/go-cqhttp/GetGroupFileUrl.d.ts +23 -0
  35. package/lib/types/protocol/action/go-cqhttp/GetGroupFilesByFolder.d.ts +38 -0
  36. package/lib/types/protocol/action/go-cqhttp/GetGroupMsgHistory.d.ts +30 -0
  37. package/lib/types/protocol/action/go-cqhttp/GetGroupNotice.d.ts +35 -0
  38. package/lib/types/protocol/action/go-cqhttp/GetGroupRootFiles.d.ts +46 -0
  39. package/lib/types/protocol/action/go-cqhttp/GetGroupSystemMsg.d.ts +28 -0
  40. package/lib/types/protocol/action/go-cqhttp/GetStrangerInfo.d.ts +52 -0
  41. package/lib/types/protocol/action/go-cqhttp/MarkMsgAsRead.d.ts +15 -0
  42. package/lib/types/protocol/action/go-cqhttp/OCRImage.d.ts +37 -0
  43. package/lib/types/protocol/action/go-cqhttp/SendForwardMsg.d.ts +76 -0
  44. package/lib/types/protocol/action/go-cqhttp/SendGroupNotice.d.ts +36 -0
  45. package/lib/types/protocol/action/go-cqhttp/SendGroupSign.d.ts +15 -0
  46. package/lib/types/protocol/action/go-cqhttp/SetEssenceMsg.d.ts +15 -0
  47. package/lib/types/protocol/action/go-cqhttp/SetGroupPortrait.d.ts +19 -0
  48. package/lib/types/protocol/action/go-cqhttp/SetGroupSpecialTitle.d.ts +21 -0
  49. package/lib/types/protocol/action/go-cqhttp/SetQQProfile.d.ts +18 -0
  50. package/lib/types/protocol/action/go-cqhttp/UploadGroupFile.d.ts +32 -0
  51. package/lib/types/protocol/action/go-cqhttp/UploadPrivateFile.d.ts +26 -0
  52. package/lib/types/protocol/action/group/GetGroupHonorInfo.d.ts +38 -0
  53. package/lib/types/protocol/action/group/GetGroupInfo.d.ts +32 -0
  54. package/lib/types/protocol/action/group/GetGroupList.d.ts +29 -0
  55. package/lib/types/protocol/action/group/GetGroupMemberInfo.d.ts +22 -0
  56. package/lib/types/protocol/action/group/GetGroupMemberList.d.ts +19 -0
  57. package/lib/types/protocol/action/group/GetGuildList.d.ts +6 -0
  58. package/lib/types/protocol/action/group/SendGroupMsg.d.ts +10 -0
  59. package/lib/types/protocol/action/group/SetGroupAddRequest.d.ts +21 -0
  60. package/lib/types/protocol/action/group/SetGroupAdmin.d.ts +21 -0
  61. package/lib/types/protocol/action/group/SetGroupBan.d.ts +21 -0
  62. package/lib/types/protocol/action/group/SetGroupCard.d.ts +21 -0
  63. package/lib/types/protocol/action/group/SetGroupKick.d.ts +21 -0
  64. package/lib/types/protocol/action/group/SetGroupLeave.d.ts +16 -0
  65. package/lib/types/protocol/action/group/SetGroupName.d.ts +18 -0
  66. package/lib/types/protocol/action/group/SetGroupWholeBan.d.ts +18 -0
  67. package/lib/types/protocol/action/index.d.ts +3 -0
  68. package/lib/types/protocol/action/llbot/file/DownloadFlashFile.d.ts +6 -0
  69. package/lib/types/protocol/action/llbot/file/GetFlashFileDownloadUrls.d.ts +26 -0
  70. package/lib/types/protocol/action/llbot/file/GetFlashFileInfo.d.ts +41 -0
  71. package/lib/types/protocol/action/llbot/file/GetPrivateFileUrl.d.ts +19 -0
  72. package/lib/types/protocol/action/llbot/file/GetRkey.d.ts +18 -0
  73. package/lib/types/protocol/action/llbot/file/MoveGroupFile.d.ts +24 -0
  74. package/lib/types/protocol/action/llbot/file/ReShareFlashFile.d.ts +17 -0
  75. package/lib/types/protocol/action/llbot/file/RenameGroupFile.d.ts +24 -0
  76. package/lib/types/protocol/action/llbot/file/RenameGroupFileFolder.d.ts +21 -0
  77. package/lib/types/protocol/action/llbot/file/SetGroupFileForever.d.ts +18 -0
  78. package/lib/types/protocol/action/llbot/file/UploadFlashFile.d.ts +41 -0
  79. package/lib/types/protocol/action/llbot/group/BatchDeleteGroupMember.d.ts +18 -0
  80. package/lib/types/protocol/action/llbot/group/DeleteGroupNotice.d.ts +18 -0
  81. package/lib/types/protocol/action/llbot/group/GetGroupAddRequest.d.ts +12 -0
  82. package/lib/types/protocol/action/llbot/group/GetGroupNoticeAcklist.d.ts +30 -0
  83. package/lib/types/protocol/action/llbot/group/GetGroupShutList.d.ts +38 -0
  84. package/lib/types/protocol/action/llbot/group/GetGroupSignedList.d.ts +26 -0
  85. package/lib/types/protocol/action/llbot/group/GroupAlbum/CreateGroupAlbum.d.ts +21 -0
  86. package/lib/types/protocol/action/llbot/group/GroupAlbum/DeleteGroupAlbum.d.ts +18 -0
  87. package/lib/types/protocol/action/llbot/group/GroupAlbum/GetGroupAlbumList.d.ts +132 -0
  88. package/lib/types/protocol/action/llbot/group/GroupAlbum/GetGroupAlbumMediaList.d.ts +306 -0
  89. package/lib/types/protocol/action/llbot/group/GroupAlbum/UploadGroupAlbum.d.ts +21 -0
  90. package/lib/types/protocol/action/llbot/group/GroupPoke.d.ts +18 -0
  91. package/lib/types/protocol/action/llbot/group/SetGroupMsgMask.d.ts +18 -0
  92. package/lib/types/protocol/action/llbot/group/SetGroupRemark.d.ts +18 -0
  93. package/lib/types/protocol/action/llbot/msg/FetchCustomFace.d.ts +6 -0
  94. package/lib/types/protocol/action/llbot/msg/FetchEmojiLike.d.ts +37 -0
  95. package/lib/types/protocol/action/llbot/msg/ForwardSingleMsg.d.ts +31 -0
  96. package/lib/types/protocol/action/llbot/msg/GetAiCharacters.d.ts +26 -0
  97. package/lib/types/protocol/action/llbot/msg/GetFriendMsgHistory.d.ts +30 -0
  98. package/lib/types/protocol/action/llbot/msg/GetRecommendFace.d.ts +20 -0
  99. package/lib/types/protocol/action/llbot/msg/SendGroupAiRecord.d.ts +27 -0
  100. package/lib/types/protocol/action/llbot/msg/SendPoke.d.ts +21 -0
  101. package/lib/types/protocol/action/llbot/msg/SetMsgEmojiLike.d.ts +26 -0
  102. package/lib/types/protocol/action/llbot/msg/VoiceMsg2Text.d.ts +17 -0
  103. package/lib/types/protocol/action/llbot/system/Config.d.ts +32 -0
  104. package/lib/types/protocol/action/llbot/system/Debug.d.ts +21 -0
  105. package/lib/types/protocol/action/llbot/system/GetRobotUinRange.d.ts +10 -0
  106. package/lib/types/protocol/action/llbot/system/ScanQRCode.d.ts +18 -0
  107. package/lib/types/protocol/action/llbot/system/SendPB.d.ts +27 -0
  108. package/lib/types/protocol/action/llbot/user/FriendPoke.d.ts +18 -0
  109. package/lib/types/protocol/action/llbot/user/GetDoubtFriendsAddRequest.d.ts +36 -0
  110. package/lib/types/protocol/action/llbot/user/GetFriendWithCategory.d.ts +23 -0
  111. package/lib/types/protocol/action/llbot/user/GetProfileLike.d.ts +41 -0
  112. package/lib/types/protocol/action/llbot/user/GetProfileLikeCount.d.ts +18 -0
  113. package/lib/types/protocol/action/llbot/user/GetProfileLikeMe.d.ts +23 -0
  114. package/lib/types/protocol/action/llbot/user/GetQQAvatar.d.ts +23 -0
  115. package/lib/types/protocol/action/llbot/user/SetDoubtFriendsAddRequest.d.ts +15 -0
  116. package/lib/types/protocol/action/llbot/user/SetFriendCategory.d.ts +18 -0
  117. package/lib/types/protocol/action/llbot/user/SetFriendRemark.d.ts +18 -0
  118. package/lib/types/protocol/action/llbot/user/SetInputStatus.d.ts +18 -0
  119. package/lib/types/protocol/action/llbot/user/SetOnlineStatus.d.ts +21 -0
  120. package/lib/types/protocol/action/llbot/user/SetQQAvatar.d.ts +15 -0
  121. package/lib/types/protocol/action/msg/DeleteMsg.d.ts +15 -0
  122. package/lib/types/protocol/action/msg/GetMsg.d.ts +18 -0
  123. package/lib/types/protocol/action/msg/SendMsg.d.ts +26 -0
  124. package/lib/types/protocol/action/msg/SendPrivateMsg.d.ts +10 -0
  125. package/lib/types/protocol/action/system/CanSendImage.d.ts +5 -0
  126. package/lib/types/protocol/action/system/CanSendRecord.d.ts +12 -0
  127. package/lib/types/protocol/action/system/CleanCache.d.ts +6 -0
  128. package/lib/types/protocol/action/system/GetCredentials.d.ts +22 -0
  129. package/lib/types/protocol/action/system/GetCsrfToken.d.ts +12 -0
  130. package/lib/types/protocol/action/system/GetLoginInfo.d.ts +11 -0
  131. package/lib/types/protocol/action/system/GetStatus.d.ts +7 -0
  132. package/lib/types/protocol/action/system/GetVersionInfo.d.ts +7 -0
  133. package/lib/types/protocol/action/system/SetRestart.d.ts +6 -0
  134. package/lib/types/protocol/action/types.d.ts +133 -0
  135. package/lib/types/protocol/action/user/GetCookie.d.ts +22 -0
  136. package/lib/types/protocol/action/user/GetFriendList.d.ts +7 -0
  137. package/lib/types/protocol/action/user/SendLike.d.ts +18 -0
  138. package/lib/types/protocol/action/user/SetFriendAddRequest.d.ts +21 -0
  139. package/lib/types/protocol/cqcode.d.ts +3 -0
  140. package/lib/types/protocol/entities.d.ts +14 -0
  141. package/lib/types/protocol/event/OB11BaseEvent.d.ts +15 -0
  142. package/lib/types/protocol/event/index.d.ts +47 -0
  143. package/lib/types/protocol/event/message/OB11MessageEvent.d.ts +2 -0
  144. package/lib/types/protocol/event/meta/OB11BaseMetaEvent.d.ts +5 -0
  145. package/lib/types/protocol/event/meta/OB11HeartbeatEvent.d.ts +12 -0
  146. package/lib/types/protocol/event/meta/OB11LifeCycleEvent.d.ts +11 -0
  147. package/lib/types/protocol/event/notice/OB11BaseNoticeEvent.d.ts +4 -0
  148. package/lib/types/protocol/event/notice/OB11FlashFileEvent.d.ts +36 -0
  149. package/lib/types/protocol/event/notice/OB11FriendAddNoticeEvent.d.ts +6 -0
  150. package/lib/types/protocol/event/notice/OB11FriendRecallNoticeEvent.d.ts +7 -0
  151. package/lib/types/protocol/event/notice/OB11GroupAdminNoticeEvent.d.ts +8 -0
  152. package/lib/types/protocol/event/notice/OB11GroupBanEvent.d.ts +10 -0
  153. package/lib/types/protocol/event/notice/OB11GroupCardEvent.d.ts +9 -0
  154. package/lib/types/protocol/event/notice/OB11GroupDecreaseEvent.d.ts +10 -0
  155. package/lib/types/protocol/event/notice/OB11GroupDismissEvent.d.ts +7 -0
  156. package/lib/types/protocol/event/notice/OB11GroupEssenceEvent.d.ts +11 -0
  157. package/lib/types/protocol/event/notice/OB11GroupIncreaseEvent.d.ts +11 -0
  158. package/lib/types/protocol/event/notice/OB11GroupNoticeEvent.d.ts +6 -0
  159. package/lib/types/protocol/event/notice/OB11GroupRecallNoticeEvent.d.ts +9 -0
  160. package/lib/types/protocol/event/notice/OB11GroupTitleEvent.d.ts +9 -0
  161. package/lib/types/protocol/event/notice/OB11GroupUploadNoticeEvent.d.ts +14 -0
  162. package/lib/types/protocol/event/notice/OB11MsgEmojiLikeEvent.d.ts +15 -0
  163. package/lib/types/protocol/event/notice/OB11PokeEvent.d.ts +25 -0
  164. package/lib/types/protocol/event/notice/OB11ProfileLikeEvent.d.ts +9 -0
  165. package/lib/types/protocol/event/request/OB11FriendRequest.d.ts +11 -0
  166. package/lib/types/protocol/event/request/OB11GroupRequest.d.ts +25 -0
  167. package/lib/types/protocol/host.d.ts +8 -0
  168. package/lib/types/protocol/index.d.ts +14 -0
  169. package/lib/types/protocol/support/utils.d.ts +28 -0
  170. package/lib/types/protocol/transform/message/incoming.d.ts +7 -0
  171. package/lib/types/protocol/transform/message/index.d.ts +1 -0
  172. package/lib/types/protocol/transform/message/outgoing.d.ts +8 -0
  173. package/lib/types/protocol/types.d.ts +389 -0
  174. package/lib/types/protocol/utils.d.ts +21 -0
  175. package/lib/types/settings.d.ts +5 -0
  176. package/lib/types/support.d.ts +3 -0
  177. package/package.json +92 -7
@@ -0,0 +1,14 @@
1
+ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
2
+ export interface GroupUploadFile {
3
+ id: string;
4
+ name: string;
5
+ size: number;
6
+ busid: number;
7
+ }
8
+ export declare class OB11GroupUploadNoticeEvent extends OB11GroupNoticeEvent {
9
+ notice_type: string;
10
+ file: GroupUploadFile;
11
+ group_id: number;
12
+ user_id: number;
13
+ constructor(groupId: number, userId: number, file: GroupUploadFile);
14
+ }
@@ -0,0 +1,15 @@
1
+ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
2
+ interface MsgEmojiLike {
3
+ emoji_id: string;
4
+ count: number;
5
+ }
6
+ export declare class OB11GroupMsgEmojiLikeEvent extends OB11GroupNoticeEvent {
7
+ notice_type: string;
8
+ message_id: number;
9
+ likes: MsgEmojiLike[];
10
+ group_id: number;
11
+ user_id: number;
12
+ is_add: boolean;
13
+ constructor(groupId: number, userId: number, messageId: number, likes: MsgEmojiLike[], isAdd: boolean);
14
+ }
15
+ export {};
@@ -0,0 +1,25 @@
1
+ import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
2
+ declare abstract class OB11PokeEvent extends OB11BaseNoticeEvent {
3
+ notice_type: string;
4
+ sub_type: 'poke' | 'poke_recall';
5
+ target_id: number;
6
+ abstract user_id: number;
7
+ }
8
+ export declare class OB11FriendPokeEvent extends OB11PokeEvent {
9
+ user_id: number;
10
+ raw_info: unknown;
11
+ constructor(user_id: number, target_id: number, raw_message: unknown);
12
+ }
13
+ export declare class OB11GroupPokeEvent extends OB11PokeEvent {
14
+ user_id: number;
15
+ group_id: number;
16
+ raw_info: unknown;
17
+ constructor(group_id: number, user_id: number, target_id: number, raw_message: unknown);
18
+ }
19
+ export declare class OB11FriendPokeRecallEvent extends OB11FriendPokeEvent {
20
+ sub_type: 'poke' | 'poke_recall';
21
+ }
22
+ export declare class OB11GroupPokeRecallEvent extends OB11GroupPokeEvent {
23
+ sub_type: 'poke' | 'poke_recall';
24
+ }
25
+ export {};
@@ -0,0 +1,9 @@
1
+ import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
2
+ export declare class OB11ProfileLikeEvent extends OB11BaseNoticeEvent {
3
+ notice_type: string;
4
+ sub_type: string;
5
+ operator_id: number;
6
+ operator_nick: string;
7
+ times: number;
8
+ constructor(operatorId: number, operatorNick: string, times: number);
9
+ }
@@ -0,0 +1,11 @@
1
+ import { OB11BaseNoticeEvent } from '../notice/OB11BaseNoticeEvent';
2
+ import { EventType } from '../OB11BaseEvent';
3
+ export declare class OB11FriendRequestEvent extends OB11BaseNoticeEvent {
4
+ post_type: EventType;
5
+ request_type: string;
6
+ user_id: number;
7
+ comment: string;
8
+ flag: string;
9
+ via: string;
10
+ constructor(userId: number, comment: string, flag: string, via: string);
11
+ }
@@ -0,0 +1,25 @@
1
+ import { OB11BaseNoticeEvent } from '../notice/OB11BaseNoticeEvent';
2
+ import { EventType } from '../OB11BaseEvent';
3
+ export declare class OB11GroupRequestAddEvent extends OB11BaseNoticeEvent {
4
+ post_type: EventType;
5
+ request_type: string;
6
+ sub_type: 'add';
7
+ group_id: number;
8
+ user_id: number;
9
+ comment: string;
10
+ flag: string;
11
+ invitor_id: number;
12
+ constructor(groupId: number, userId: number, flag: string, comment: string, invitorId?: number);
13
+ }
14
+ export declare class OB11GroupRequestInviteBotEvent extends OB11BaseNoticeEvent {
15
+ post_type: EventType;
16
+ request_type: string;
17
+ sub_type: 'invite';
18
+ group_id: number;
19
+ user_id: number;
20
+ comment: string;
21
+ flag: string;
22
+ source_group_id?: number;
23
+ constructor(groupId: number, userId: number, flag: string, comment: string, sourceGroupId?: number);
24
+ }
25
+ export type OB11GroupRequestEvent = OB11GroupRequestAddEvent | OB11GroupRequestInviteBotEvent;
@@ -0,0 +1,8 @@
1
+ import type { Context } from 'cordis';
2
+ import type { LegacyConfig } from '@luckylillia-dev/plugin-nt-protocol/contracts';
3
+ export declare const legacyConfig: (ctx: Context) => LegacyConfig;
4
+ export declare const applyLegacyConfig: (ctx: Context, partial: Record<string, unknown>, options?: {
5
+ rules?: boolean;
6
+ }) => Promise<unknown>;
7
+ export declare const hostVersion: (ctx: Context) => string;
8
+ export declare const musicCardSignUrl: (ctx: Context) => string | undefined;
@@ -0,0 +1,14 @@
1
+ export * from './types';
2
+ export * from './entities';
3
+ export * from './utils';
4
+ export * from './cqcode';
5
+ export * from './event';
6
+ export * from './action';
7
+ export * from './action/types';
8
+ export * from './action/BaseAction';
9
+ export * from './action/OB11Response';
10
+ export * from './transform/message';
11
+ export { transformOutgoingSegments } from './transform/message/outgoing';
12
+ export { LifeCycleSubType } from './event/meta/OB11LifeCycleEvent';
13
+ export type { GroupDecreaseSubType } from './event/notice/OB11GroupDecreaseEvent';
14
+ export { OB11GroupRequestAddEvent, OB11GroupRequestInviteBotEvent } from './event/request/OB11GroupRequest';
@@ -0,0 +1,28 @@
1
+ import { Dict } from 'cosmokit';
2
+ export declare function isNumeric(str: string): boolean;
3
+ /** 只补 oldObj 缺的属性 */
4
+ export declare function mergeNewProperties(newObj: Dict, oldObj: Dict): void;
5
+ /** 对象逐 key 递归, 数组和标量整体替换; patch 覆盖已有值 */
6
+ export declare function deepMerge(base: unknown, patch: unknown): unknown;
7
+ export declare function filterNullable<T>(array: T[]): NonNullable<T>[];
8
+ export declare function parseBool(value: string): boolean;
9
+ export declare class DetailedError<T> extends Error {
10
+ data: T;
11
+ constructor(message: string, data: T);
12
+ }
13
+ export type DeepNonNullable<T> = T extends object ? {
14
+ [K in keyof T]-?: DeepNonNullable<NonNullable<T[K]>>;
15
+ } : NonNullable<T>;
16
+ export type DeepPartial<T> = T extends object ? T extends (...args: any[]) => any ? T : {
17
+ [K in keyof T]?: DeepPartial<T[K]>;
18
+ } : T;
19
+ export declare const cloneObj: <T>(obj: T) => T;
20
+ export declare function uint32ToIPV4Addr(value: number): string;
21
+ export declare function sleep(ms?: number): Promise<void>;
22
+ /** 结果与输入同序。shouldStop 返回 true 后不再派发新任务, 没启动的位置留 undefined */
23
+ export declare function mapWithConcurrency<T, R>(items: T[], concurrency: number, fn: (item: T, index: number) => Promise<R>, shouldStop?: (result: R, index: number) => boolean): Promise<R[]>;
24
+ export declare function isHttpUrl(str: string): boolean;
25
+ export declare function formatYYYYMMDD(date?: Date): string;
26
+ /** 原地修改, 返回原数组 */
27
+ export declare function moveElement<T>(arr: T[], from: number, to: number): T[];
28
+ export { uri2local, fetchFile, getMd5HexFromFile, getImageSize } from '@luckylillia-dev/plugin-nt-protocol/helpers';
@@ -0,0 +1,7 @@
1
+ import { RawMessage } from '@luckylillia-dev/plugin-nt-protocol/api';
2
+ import { OB11MessageData } from '../../types';
3
+ import { Context } from 'cordis';
4
+ export declare function transformIncomingSegments(ctx: Context, message: RawMessage): Promise<{
5
+ segments: OB11MessageData[];
6
+ cqCode: string;
7
+ }>;
@@ -0,0 +1 @@
1
+ export * from './incoming';
@@ -0,0 +1,8 @@
1
+ import { SendMessageElement } from '@luckylillia-dev/plugin-nt-protocol/api';
2
+ import { OB11MessageData } from '../../types';
3
+ import { Peer } from '@luckylillia-dev/plugin-nt-protocol/api';
4
+ import { Context } from 'cordis';
5
+ export declare function transformOutgoingSegments(ctx: Context, messageData: OB11MessageData[], peer: Peer, isInsideForward: boolean): Promise<{
6
+ sendElements: SendMessageElement[];
7
+ deleteAfterSentFiles: string[];
8
+ }>;
@@ -0,0 +1,389 @@
1
+ import { FaceType, PicSubType, RawMessage } from '@luckylillia-dev/plugin-nt-protocol/api';
2
+ import { EventType } from './event/OB11BaseEvent';
3
+ import { IdMusicCardData, CustomMusicCardData } from '@luckylillia-dev/plugin-nt-protocol/helpers';
4
+ export interface OB11User {
5
+ user_id: number;
6
+ nickname: string;
7
+ remark?: string;
8
+ sex?: OB11UserSex;
9
+ birthday_year?: number;
10
+ birthday_month?: number;
11
+ birthday_day?: number;
12
+ age?: number;
13
+ qid?: string;
14
+ long_nick?: string;
15
+ }
16
+ export declare enum OB11UserSex {
17
+ Male = "male",
18
+ Female = "female",
19
+ Unknown = "unknown"
20
+ }
21
+ export declare enum OB11GroupMemberRole {
22
+ Owner = "owner",
23
+ Admin = "admin",
24
+ Member = "member"
25
+ }
26
+ export interface OB11GroupMember {
27
+ group_id: number;
28
+ user_id: number;
29
+ nickname: string;
30
+ card: string;
31
+ card_or_nickname: string;
32
+ sex: OB11UserSex;
33
+ age: number;
34
+ join_time: number;
35
+ last_sent_time: number;
36
+ level: string;
37
+ qq_level?: number;
38
+ role: OB11GroupMemberRole;
39
+ title: string;
40
+ area: string;
41
+ unfriendly: boolean;
42
+ title_expire_time: number;
43
+ card_changeable: boolean;
44
+ shut_up_timestamp: number;
45
+ is_robot?: boolean;
46
+ qage?: number;
47
+ }
48
+ export interface OB11Group {
49
+ group_id: number;
50
+ group_name: string;
51
+ group_memo: string;
52
+ group_create_time: number;
53
+ member_count: number;
54
+ max_member_count: number;
55
+ remark_name: string;
56
+ owner_id: number;
57
+ is_top: boolean;
58
+ shut_up_all_timestamp: number;
59
+ shut_up_me_timestamp: number;
60
+ }
61
+ interface OB11Sender {
62
+ user_id: number;
63
+ nickname: string;
64
+ sex?: OB11UserSex;
65
+ age?: number;
66
+ card?: string;
67
+ level?: string;
68
+ role?: OB11GroupMemberRole;
69
+ group_id?: number;
70
+ title?: string;
71
+ }
72
+ export declare enum OB11MessageType {
73
+ private = "private",
74
+ group = "group"
75
+ }
76
+ export interface OB11Message {
77
+ target_id?: number;
78
+ self_id: number;
79
+ time: number;
80
+ message_id: number;
81
+ message_seq: number;
82
+ real_id?: number;
83
+ user_id: number;
84
+ group_id?: number;
85
+ group_name?: string;
86
+ message_type: 'private' | 'group';
87
+ sub_type?: 'friend' | 'group' | 'normal';
88
+ sender: OB11Sender;
89
+ message: OB11MessageData[] | string;
90
+ message_format: 'array' | 'string';
91
+ raw_message: string;
92
+ font: number;
93
+ post_type: EventType;
94
+ raw?: RawMessage;
95
+ raw_pb?: string;
96
+ temp_source?: 0 | 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9;
97
+ status?: 'normal' | 'deleted';
98
+ getSummaryEventName(): string;
99
+ }
100
+ export interface OB11ForwardMessage {
101
+ content: OB11MessageData[] | string;
102
+ sender: {
103
+ nickname: string;
104
+ user_id: number;
105
+ };
106
+ time: number;
107
+ message_format: string;
108
+ message_type: string;
109
+ }
110
+ export interface OB11Return<DataType> {
111
+ status: string;
112
+ retcode: number;
113
+ data: DataType;
114
+ message: string;
115
+ echo?: unknown;
116
+ wording?: string;
117
+ }
118
+ export declare enum OB11MessageDataType {
119
+ Text = "text",
120
+ Image = "image",
121
+ Music = "music",
122
+ Video = "video",
123
+ Record = "record",
124
+ File = "file",
125
+ FlashFile = "flash_file",// 闪传
126
+ At = "at",
127
+ Reply = "reply",
128
+ Json = "json",
129
+ Face = "face",
130
+ Mface = "mface",// 商城表情
131
+ Markdown = "markdown",
132
+ Node = "node",// 合并转发消息节点
133
+ Forward = "forward",// 合并转发消息,用于上报
134
+ Xml = "xml",
135
+ Poke = "poke",
136
+ Dice = "dice",
137
+ Rps = "rps",
138
+ Contact = "contact",
139
+ Shake = "shake",
140
+ Keyboard = "keyboard"
141
+ }
142
+ export interface OB11MessageMFace {
143
+ type: OB11MessageDataType.Mface;
144
+ data: {
145
+ emoji_package_id: number;
146
+ emoji_id: string;
147
+ key: string;
148
+ summary?: string;
149
+ url?: string;
150
+ };
151
+ }
152
+ export interface OB11MessageKeyboard {
153
+ type: OB11MessageDataType.Keyboard;
154
+ data: {
155
+ rows: {
156
+ buttons: {
157
+ id: string;
158
+ render_data: {
159
+ label: string;
160
+ visited_label: string;
161
+ style: number;
162
+ };
163
+ action: {
164
+ type: number;
165
+ permission: {
166
+ type: number;
167
+ specify_role_ids: string[];
168
+ specify_user_ids: string[];
169
+ };
170
+ unsupport_tips: string;
171
+ data: string;
172
+ reply: boolean;
173
+ enter: boolean;
174
+ };
175
+ }[];
176
+ }[];
177
+ };
178
+ }
179
+ export interface OB11MessageDice {
180
+ type: OB11MessageDataType.Dice;
181
+ data: {
182
+ result: number | string;
183
+ };
184
+ }
185
+ export interface OB11MessageRPS {
186
+ type: OB11MessageDataType.Rps;
187
+ data: {
188
+ result: number | string;
189
+ };
190
+ }
191
+ export interface OB11MessageText {
192
+ type: OB11MessageDataType.Text;
193
+ data: {
194
+ text: string;
195
+ };
196
+ }
197
+ export interface OB11MessagePoke {
198
+ type: OB11MessageDataType.Poke;
199
+ data: {
200
+ qq?: number;
201
+ id?: number;
202
+ };
203
+ }
204
+ export interface OB11MessageFileBase {
205
+ data: {
206
+ name?: string;
207
+ file: string;
208
+ url?: string;
209
+ file_size?: string;
210
+ };
211
+ }
212
+ export interface OB11MessageImage extends OB11MessageFileBase {
213
+ type: OB11MessageDataType.Image;
214
+ data: OB11MessageFileBase['data'] & {
215
+ summary?: string;
216
+ subType?: PicSubType;
217
+ type?: 'flash' | 'show';
218
+ };
219
+ }
220
+ export interface OB11MessageRecord extends OB11MessageFileBase {
221
+ type: OB11MessageDataType.Record;
222
+ data: OB11MessageFileBase['data'] & {
223
+ path?: string;
224
+ };
225
+ }
226
+ export interface OB11MessageFile extends OB11MessageFileBase {
227
+ type: OB11MessageDataType.File;
228
+ data: OB11MessageFileBase['data'] & {
229
+ file_id?: string;
230
+ path?: string;
231
+ };
232
+ }
233
+ export interface OB11MessageFlashFile {
234
+ type: OB11MessageDataType.FlashFile;
235
+ data: {
236
+ title: string;
237
+ file_set_id: string;
238
+ scene_type: number;
239
+ };
240
+ }
241
+ export interface OB11MessageVideo extends OB11MessageFileBase {
242
+ type: OB11MessageDataType.Video;
243
+ data: OB11MessageFileBase['data'] & {
244
+ cover?: string;
245
+ thumb?: string;
246
+ path?: string;
247
+ };
248
+ }
249
+ export interface OB11MessageAt {
250
+ type: OB11MessageDataType.At;
251
+ data: {
252
+ qq: string | 'all';
253
+ name?: string;
254
+ };
255
+ }
256
+ export interface OB11MessageReply {
257
+ type: OB11MessageDataType.Reply;
258
+ data: {
259
+ id: string;
260
+ };
261
+ }
262
+ export interface OB11MessageFace {
263
+ type: OB11MessageDataType.Face;
264
+ data: {
265
+ id: string;
266
+ sub_type?: FaceType;
267
+ };
268
+ }
269
+ export type OB11MessageMixType = OB11MessageData[] | string | OB11MessageData;
270
+ export interface OB11MessageNode {
271
+ type: OB11MessageDataType.Node;
272
+ data: {
273
+ id?: number | string;
274
+ content?: OB11MessageMixType;
275
+ user_id?: number | string;
276
+ nickname?: string;
277
+ name?: string;
278
+ uin?: number | string;
279
+ source?: string;
280
+ news?: {
281
+ text: string;
282
+ }[];
283
+ summary?: string;
284
+ prompt?: string;
285
+ time?: number | string;
286
+ seq?: number | string;
287
+ message_style?: {
288
+ bubble_id: number;
289
+ pendant_id: number;
290
+ font_id: number;
291
+ font_effect_id: number;
292
+ is_cs_font_effect_enabled: boolean;
293
+ bubble_diy_text_id: number;
294
+ };
295
+ };
296
+ }
297
+ export interface OB11MessageIdMusic {
298
+ type: OB11MessageDataType.Music;
299
+ data: IdMusicCardData;
300
+ }
301
+ export interface OB11MessageCustomMusic {
302
+ type: OB11MessageDataType.Music;
303
+ data: CustomMusicCardData;
304
+ }
305
+ export type OB11MessageMusic = OB11MessageIdMusic | OB11MessageCustomMusic;
306
+ export interface OB11MessageJson {
307
+ type: OB11MessageDataType.Json;
308
+ data: {
309
+ data: string;
310
+ };
311
+ }
312
+ export interface OB11MessageMarkdown {
313
+ type: OB11MessageDataType.Markdown;
314
+ data: {
315
+ content: string;
316
+ };
317
+ }
318
+ export interface OB11MessageForward {
319
+ type: OB11MessageDataType.Forward;
320
+ data: {
321
+ id: string;
322
+ /** get_forward_msg extension: expanded inner messages; absent if unavailable or expansion was limited. */
323
+ content?: OB11ForwardMessage[];
324
+ };
325
+ }
326
+ export interface OB11MessageContact {
327
+ type: OB11MessageDataType.Contact;
328
+ data: {
329
+ type: 'qq' | 'group';
330
+ id: string;
331
+ };
332
+ }
333
+ export interface OB11MessageShake {
334
+ type: OB11MessageDataType.Shake;
335
+ data: Record<string, never>;
336
+ }
337
+ export type OB11MessageData = OB11MessageText | OB11MessageFace | OB11MessageMFace | OB11MessageAt | OB11MessageReply | OB11MessageImage | OB11MessageRecord | OB11MessageFile | OB11MessageFlashFile | OB11MessageVideo | OB11MessageNode | OB11MessageIdMusic | OB11MessageCustomMusic | OB11MessageJson | OB11MessagePoke | OB11MessageDice | OB11MessageRPS | OB11MessageMarkdown | OB11MessageForward | OB11MessageContact | OB11MessageShake | OB11MessageKeyboard;
338
+ export interface OB11PostSendMsg {
339
+ message_type?: 'private' | 'group';
340
+ user_id?: string | number;
341
+ group_id?: string | number;
342
+ message: OB11MessageMixType;
343
+ auto_escape?: boolean;
344
+ }
345
+ export interface OB11Version {
346
+ app_name: 'LLOneBot';
347
+ app_version: string;
348
+ protocol_version: 'v11';
349
+ }
350
+ export interface OB11Status {
351
+ online: boolean | null;
352
+ good: boolean;
353
+ stat: {
354
+ message_received: number;
355
+ message_sent: number;
356
+ last_message_time: number;
357
+ startup_time: number;
358
+ };
359
+ }
360
+ export interface OB11GroupFile {
361
+ group_id: number;
362
+ file_id: string;
363
+ file_name: string;
364
+ busid: number;
365
+ file_size: number;
366
+ upload_time: number;
367
+ dead_time: number;
368
+ modify_time: number;
369
+ download_times: number;
370
+ uploader: number;
371
+ uploader_name: string;
372
+ }
373
+ export interface OB11GroupFileFolder {
374
+ group_id: number;
375
+ folder_id: string;
376
+ folder_name: string;
377
+ create_time: number;
378
+ creator: number;
379
+ creator_name: string;
380
+ total_file_count: number;
381
+ modify_time: number;
382
+ modifier: number;
383
+ modifier_name: string;
384
+ }
385
+ export interface ParseMessageConfig {
386
+ messageFormat: 'array' | 'string';
387
+ debug: boolean;
388
+ }
389
+ export {};
@@ -0,0 +1,21 @@
1
+ import { Peer } from '@luckylillia-dev/plugin-nt-protocol/api';
2
+ import { Context } from 'cordis';
3
+ import { OB11MessageData, OB11MessageMixType } from './types';
4
+ export interface CreatePeerPayload {
5
+ group_id?: string | number;
6
+ user_id?: string | number;
7
+ }
8
+ export declare enum CreatePeerMode {
9
+ Normal = 0,
10
+ Private = 1,
11
+ Group = 2
12
+ }
13
+ export declare function createPeer(ctx: Context, payload: CreatePeerPayload, mode?: CreatePeerMode): Promise<Peer>;
14
+ export declare function message2List(message: OB11MessageMixType, autoEscape?: boolean): OB11MessageData[];
15
+ export declare function encodeGroupRequestFlag(groupCode: number, seq: number, type: number, doubt: boolean): string;
16
+ export declare function decodeGroupRequestFlag(flag: string): {
17
+ groupCode: number;
18
+ seq: number;
19
+ type: number;
20
+ doubt: boolean;
21
+ };
@@ -0,0 +1,5 @@
1
+ import Schema from 'schemastery';
2
+ import type { OB11Config } from './config';
3
+ export type OB11Settings = Omit<OB11Config, 'enable'>;
4
+ export declare const OB11Schema: Schema<OB11Settings>;
5
+ export declare function validateListeners(config: OB11Settings): void;
@@ -0,0 +1,3 @@
1
+ import type { Context } from 'cordis';
2
+ export declare const hostVersion: (ctx: Context) => string;
3
+ export declare const cloneObj: <T>(obj: T) => T;