@saltify/milky-types 1.0.0-draft.1 → 1.0.0-draft.11

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.
@@ -1,94 +0,0 @@
1
- import { z } from 'zod';
2
- import { ZInt32, ZInt64, ZString } from '../scalar';
3
- import { OutgoingSegment, IncomingMessage, IncomingForwardedMessage } from '../message';
4
-
5
- const SendMessageApiBase = z.object({
6
- message: z.array(z.lazy(() => OutgoingSegment)).describe('消息内容'),
7
- });
8
-
9
- const SendMessageApiCommonOutput = z.object({
10
- message_seq: ZInt64.describe('消息序列号'),
11
- time: ZInt64.describe('消息发送时间'),
12
- });
13
-
14
- export const SendPrivateMessageInput = z.object({
15
- user_id: ZInt64.describe('好友 QQ 号'),
16
- }).extend(SendMessageApiBase.shape);
17
-
18
- export const SendPrivateMessageOutput = SendMessageApiCommonOutput;
19
-
20
- export const SendGroupMessageInput = z.object({
21
- group_id: ZInt64.describe('群号'),
22
- }).extend(SendMessageApiBase.shape);
23
-
24
- export const SendGroupMessageOutput = SendMessageApiCommonOutput;
25
-
26
- export const GetMessageInput = z.object({
27
- message_scene: z.enum(['friend', 'group', 'temp']).describe('消息场景'),
28
- peer_id: ZInt64.describe('好友 QQ 号或群号'),
29
- message_seq: ZInt64.describe('消息序列号'),
30
- });
31
-
32
- export const GetMessageOutput = z.object({
33
- message: z.lazy(() => IncomingMessage).describe('消息内容'),
34
- });
35
-
36
- export const GetHistoryMessagesInput = z.object({
37
- message_scene: z.enum(['friend', 'group', 'temp']).describe('消息场景'),
38
- peer_id: ZInt64.describe('好友 QQ 号或群号'),
39
- start_message_seq: ZInt64.optional().describe('起始消息序列号,由此开始从新到旧查询,不提供则从最新消息开始'),
40
- limit: ZInt32.max(30).default(20).describe('期望获取到的消息数量,最多 30 条'),
41
- });
42
-
43
- export const GetHistoryMessagesOutput = z.object({
44
- messages: z.array(z.lazy(() => IncomingMessage)).describe('获取到的消息(message_seq 升序排列),部分消息可能不存在,如撤回的消息'),
45
- next_message_seq: ZInt64.optional().describe('下一页起始消息序列号'),
46
- });
47
-
48
- export const GetResourceTempUrlInput = z.object({
49
- resource_id: ZString.describe('资源 ID'),
50
- });
51
-
52
- export const GetResourceTempUrlOutput = z.object({
53
- url: ZString.describe('临时资源链接'),
54
- });
55
-
56
- export const GetForwardedMessagesInput = z.object({
57
- forward_id: ZString.describe('转发消息 ID'),
58
- });
59
-
60
- export const GetForwardedMessagesOutput = z.object({
61
- messages: z.array(z.lazy(() => IncomingForwardedMessage)).describe('转发消息内容'),
62
- });
63
-
64
- export const RecallPrivateMessageInput = z.object({
65
- user_id: ZInt64.describe('好友 QQ 号'),
66
- message_seq: ZInt64.describe('消息序列号'),
67
- });
68
-
69
- export const RecallGroupMessageInput = z.object({
70
- group_id: ZInt64.describe('群号'),
71
- message_seq: ZInt64.describe('消息序列号'),
72
- });
73
-
74
- export const MarkMessageAsReadInput = z.object({
75
- message_scene: z.enum(['friend', 'group', 'temp']).describe('消息场景'),
76
- peer_id: ZInt64.describe('好友 QQ 号或群号'),
77
- message_seq: ZInt64.describe('标为已读的消息序列号,该消息及更早的消息将被标记为已读'),
78
- });
79
-
80
- export type SendPrivateMessageInput = z.infer<typeof SendPrivateMessageInput>;
81
- export type SendPrivateMessageOutput = z.infer<typeof SendPrivateMessageOutput>;
82
- export type SendGroupMessageInput = z.infer<typeof SendGroupMessageInput>;
83
- export type SendGroupMessageOutput = z.infer<typeof SendGroupMessageOutput>;
84
- export type GetMessageInput = z.infer<typeof GetMessageInput>;
85
- export type GetMessageOutput = z.infer<typeof GetMessageOutput>;
86
- export type GetHistoryMessagesInput = z.infer<typeof GetHistoryMessagesInput>;
87
- export type GetHistoryMessagesOutput = z.infer<typeof GetHistoryMessagesOutput>;
88
- export type GetResourceTempUrlInput = z.infer<typeof GetResourceTempUrlInput>;
89
- export type GetResourceTempUrlOutput = z.infer<typeof GetResourceTempUrlOutput>;
90
- export type GetForwardedMessagesInput = z.infer<typeof GetForwardedMessagesInput>;
91
- export type GetForwardedMessagesOutput = z.infer<typeof GetForwardedMessagesOutput>;
92
- export type RecallPrivateMessageInput = z.infer<typeof RecallPrivateMessageInput>;
93
- export type RecallGroupMessageInput = z.infer<typeof RecallGroupMessageInput>;
94
- export type MarkMessageAsReadInput = z.infer<typeof MarkMessageAsReadInput>;
package/src/api/system.ts DELETED
@@ -1,125 +0,0 @@
1
- import { z } from 'zod';
2
- import { ZInt32, ZInt64, ZString, ZBoolean } from '../scalar';
3
- import { FriendEntity, GroupEntity, GroupMemberEntity } from '../common';
4
- import { milkyVersion } from '../constants';
5
-
6
- const CachedApiBase = z.object({
7
- no_cache: ZBoolean.default(false).describe('是否强制不使用缓存'),
8
- });
9
-
10
- export const GetLoginInfoOutput = z.object({
11
- uin: ZInt64.describe('登录 QQ 号'),
12
- nickname: ZString.describe('登录昵称'),
13
- });
14
-
15
- export const GetImplInfoOutput = z.object({
16
- impl_name: ZString.describe('协议端名称'),
17
- impl_version: ZString.describe('协议端版本'),
18
- qq_protocol_version: ZString.describe('协议端使用的 QQ 协议版本'),
19
- qq_protocol_type: z.enum([
20
- 'windows',
21
- 'linux',
22
- 'macos',
23
- 'android_pad',
24
- 'android_phone',
25
- 'ipad',
26
- 'iphone',
27
- 'harmony',
28
- 'watch'
29
- ]).describe('协议端使用的 QQ 协议平台'),
30
- milky_version: ZString.describe(`协议端实现的 Milky 协议版本,目前为 "${milkyVersion}"`),
31
- });
32
-
33
- export const GetUserProfileInput = z.object({
34
- user_id: ZInt64.describe('用户 QQ 号'),
35
- });
36
-
37
- export const GetUserProfileOutput = z.object({
38
- nickname: ZString.describe('昵称'),
39
- qid: ZString.describe('QID'),
40
- age: ZInt32.describe('年龄'),
41
- sex: z.enum(['male', 'female', 'unknown']).describe('性别'),
42
- remark: ZString.describe('备注'),
43
- bio: ZString.describe('个性签名'),
44
- level: ZInt32.describe('QQ 等级'),
45
- country: ZString.describe('国家或地区'),
46
- city: ZString.describe('城市'),
47
- school: ZString.describe('学校'),
48
- });
49
-
50
- export const GetFriendListInput = CachedApiBase;
51
-
52
- export const GetFriendListOutput = z.object({
53
- friends: z.array(z.lazy(() => FriendEntity)).describe('好友列表'),
54
- });
55
-
56
- export const GetFriendInfoInput = z.object({
57
- user_id: ZInt64.describe('好友 QQ 号'),
58
- }).extend(CachedApiBase.shape);
59
-
60
- export const GetFriendInfoOutput = z.object({
61
- friend: z.lazy(() => FriendEntity).describe('好友信息'),
62
- });
63
-
64
- export const GetGroupListInput = CachedApiBase;
65
-
66
- export const GetGroupListOutput = z.object({
67
- groups: z.array(z.lazy(() => GroupEntity)).describe('群列表'),
68
- });
69
-
70
- export const GetGroupInfoInput = z.object({
71
- group_id: ZInt64.describe('群号'),
72
- }).extend(CachedApiBase.shape);
73
-
74
- export const GetGroupInfoOutput = z.object({
75
- group: z.lazy(() => GroupEntity).describe('群信息'),
76
- });
77
-
78
- export const GetGroupMemberListInput = z.object({
79
- group_id: ZInt64.describe('群号'),
80
- }).extend(CachedApiBase.shape);
81
-
82
- export const GetGroupMemberListOutput = z.object({
83
- members: z.array(z.lazy(() => GroupMemberEntity)).describe('群成员列表'),
84
- });
85
-
86
- export const GetGroupMemberInfoInput = z.object({
87
- group_id: ZInt64.describe('群号'),
88
- user_id: ZInt64.describe('群成员 QQ 号'),
89
- }).extend(CachedApiBase.shape);
90
-
91
- export const GetGroupMemberInfoOutput = z.object({
92
- member: z.lazy(() => GroupMemberEntity).describe('群成员信息'),
93
- });
94
-
95
- export const GetCookiesInput = z.object({
96
- domain: ZString.describe('需要获取 Cookies 的域名'),
97
- });
98
-
99
- export const GetCookiesOutput = z.object({
100
- cookies: ZString.describe('域名对应的 Cookies 字符串'),
101
- });
102
-
103
- export const GetCSRFTokenOutput = z.object({
104
- csrf_token: ZString.describe('CSRF Token'),
105
- });
106
-
107
- export type GetLoginInfoOutput = z.infer<typeof GetLoginInfoOutput>;
108
- export type GetImplInfoOutput = z.infer<typeof GetImplInfoOutput>;
109
- export type GetUserProfileInput = z.infer<typeof GetUserProfileInput>;
110
- export type GetUserProfileOutput = z.infer<typeof GetUserProfileOutput>;
111
- export type GetFriendListInput = z.infer<typeof GetFriendListInput>;
112
- export type GetFriendListOutput = z.infer<typeof GetFriendListOutput>;
113
- export type GetFriendInfoInput = z.infer<typeof GetFriendInfoInput>;
114
- export type GetFriendInfoOutput = z.infer<typeof GetFriendInfoOutput>;
115
- export type GetGroupListInput = z.infer<typeof GetGroupListInput>;
116
- export type GetGroupListOutput = z.infer<typeof GetGroupListOutput>;
117
- export type GetGroupInfoInput = z.infer<typeof GetGroupInfoInput>;
118
- export type GetGroupInfoOutput = z.infer<typeof GetGroupInfoOutput>;
119
- export type GetGroupMemberListInput = z.infer<typeof GetGroupMemberListInput>;
120
- export type GetGroupMemberListOutput = z.infer<typeof GetGroupMemberListOutput>;
121
- export type GetGroupMemberInfoInput = z.infer<typeof GetGroupMemberInfoInput>;
122
- export type GetGroupMemberInfoOutput = z.infer<typeof GetGroupMemberInfoOutput>;
123
- export type GetCookiesInput = z.infer<typeof GetCookiesInput>;
124
- export type GetCookiesOutput = z.infer<typeof GetCookiesOutput>;
125
- export type GetCSRFTokenOutput = z.infer<typeof GetCSRFTokenOutput>;
package/src/common.ts DELETED
@@ -1,134 +0,0 @@
1
- import { z } from 'zod';
2
- import { ZInt32, ZInt64, ZString, ZBoolean } from './scalar';
3
-
4
- const UserEntityBase = z.object({
5
- user_id: ZInt64.describe('用户 QQ 号'),
6
- nickname: ZString.describe('用户昵称'),
7
- sex: z.enum(['male', 'female', 'unknown']).describe('用户性别'),
8
- }).describe('基础用户实体');
9
-
10
- export const FriendCategoryEntity = z.object({
11
- category_id: ZInt32.describe('好友分组 ID'),
12
- category_name: ZString.describe('好友分组名称'),
13
- }).describe('好友分组实体');
14
-
15
- export const FriendEntity = UserEntityBase.extend({
16
- qid: ZString.describe('用户 QID'),
17
- remark: ZString.describe('好友备注'),
18
- category: z.lazy(() => FriendCategoryEntity).describe('好友分组'),
19
- }).describe('好友实体');
20
-
21
- export const GroupEntity = z.object({
22
- group_id: ZInt64.describe('群号'),
23
- group_name: ZString.describe('群名称'),
24
- member_count: ZInt32.describe('群成员数量'),
25
- max_member_count: ZInt32.describe('群容量'),
26
- }).describe('群实体');
27
-
28
- export const GroupMemberEntity = UserEntityBase.extend({
29
- group_id: ZInt64.describe('群号'),
30
- card: ZString.describe('成员备注'),
31
- title: ZString.describe('专属头衔'),
32
- level: ZInt32.describe('群等级,注意和 QQ 等级区分'),
33
- role: z.enum(['owner', 'admin', 'member']).describe('权限等级'),
34
- join_time: ZInt64.describe('入群时间,Unix 时间戳(秒)'),
35
- last_sent_time: ZInt64.describe('最后发言时间,Unix 时间戳(秒)'),
36
- shut_up_end_time: ZInt64.optional().describe('禁言结束时间,Unix 时间戳(秒)'),
37
- }).describe('群成员实体');
38
-
39
- export const GroupAnnouncementEntity = z.object({
40
- group_id: ZInt64.describe('群号'),
41
- announcement_id: ZString.describe('公告 ID'),
42
- user_id: ZInt64.describe('发送者 QQ 号'),
43
- time: ZInt64.describe('Unix 时间戳(秒)'),
44
- content: ZString.describe('公告内容'),
45
- image_url: ZString.optional().describe('公告图片 URL'),
46
- }).describe('群公告实体');
47
-
48
- export const GroupFileEntity = z.object({
49
- group_id: ZInt64.describe('群号'),
50
- file_id: ZString.describe('文件 ID'),
51
- file_name: ZString.describe('文件名称'),
52
- parent_folder_id: ZString.describe('父文件夹 ID'),
53
- file_size: ZInt64.describe('文件大小(字节)'),
54
- uploaded_time: ZInt64.describe('上传时的 Unix 时间戳(秒)'),
55
- expire_time: ZInt64.optional().describe('过期时的 Unix 时间戳(秒)'),
56
- uploader_id: ZInt64.describe('上传者 QQ 号'),
57
- downloaded_times: ZInt32.describe('下载次数'),
58
- }).describe('群文件实体');
59
-
60
- export const GroupFolderEntity = z.object({
61
- group_id: ZInt64.describe('群号'),
62
- folder_id: ZString.describe('文件夹 ID'),
63
- parent_folder_id: ZString.describe('父文件夹 ID'),
64
- folder_name: ZString.describe('文件夹名称'),
65
- created_time: ZInt64.describe('创建时的 Unix 时间戳(秒)'),
66
- last_modified_time: ZInt64.describe('最后修改时的 Unix 时间戳(秒)'),
67
- creator_id: ZInt64.describe('创建者 QQ 号'),
68
- file_count: ZInt32.describe('文件数量'),
69
- }).describe('群文件夹实体');
70
-
71
- export const FriendRequest = z.object({
72
- time: ZInt64.describe('请求发起时的 Unix 时间戳(秒)'),
73
- initiator_id: ZInt64.describe('请求发起者 QQ 号'),
74
- initiator_uid: ZString.describe('请求发起者 UID'),
75
- target_user_id: ZInt64.describe('目标用户 QQ 号'),
76
- target_user_uid: ZString.describe('目标用户 UID'),
77
- state: z.enum(['pending', 'accepted', 'rejected', 'ignored']).describe('请求状态'),
78
- comment: ZString.describe('申请附加信息'),
79
- via: ZString.describe('申请来源'),
80
- is_filtered: ZBoolean.describe('请求是否被过滤(发起自风险账户)'),
81
- }).describe('好友请求实体');
82
-
83
- export const GroupNotification = z.discriminatedUnion('type', [
84
- z.object({
85
- type: z.literal('join_request'), // internal type: 1
86
- group_id: ZInt64.describe('群号'),
87
- notification_seq: ZInt64.describe('通知序列号'),
88
- is_filtered: ZBoolean.describe('请求是否被过滤(发起自风险账户)'),
89
- initiator_id: ZInt64.describe('发起者 QQ 号'),
90
- state: z.enum(['pending', 'accepted', 'rejected', 'ignored']).describe('请求状态'),
91
- operator_id: ZInt64.optional().describe('处理请求的管理员 QQ 号'),
92
- comment: ZString.describe('入群请求附加信息'),
93
- }).describe('用户入群请求'),
94
- z.object({
95
- type: z.literal('admin_change'), // internal type: 3 (set), 16 (unset)
96
- group_id: ZInt64.describe('群号'),
97
- notification_seq: ZInt64.describe('通知序列号'),
98
- target_user_id: ZInt64.describe('被设置/取消用户 QQ 号'),
99
- is_set: ZBoolean.describe('是否被设置为管理员,`false` 表示被取消管理员'),
100
- operator_id: ZInt64.describe('操作者(群主)QQ 号'),
101
- }).describe('群管理员变更通知'),
102
- z.object({
103
- type: z.literal('kick'), // internal type: 6, 7
104
- group_id: ZInt64.describe('群号'),
105
- notification_seq: ZInt64.describe('通知序列号'),
106
- target_user_id: ZInt64.describe('被移除用户 QQ 号'),
107
- operator_id: ZInt64.describe('移除用户的管理员 QQ 号'),
108
- }).describe('群成员被移除通知'),
109
- z.object({
110
- type: z.literal('quit'), // internal type: 13
111
- group_id: ZInt64.describe('群号'),
112
- notification_seq: ZInt64.describe('通知序列号'),
113
- target_user_id: ZInt64.describe('退群用户 QQ 号'),
114
- }).describe('群成员退群通知'),
115
- z.object({
116
- type: z.literal('invited_join_request'), // internal type: 22
117
- group_id: ZInt64.describe('群号'),
118
- notification_seq: ZInt64.describe('通知序列号'),
119
- initiator_id: ZInt64.describe('邀请者 QQ 号'),
120
- target_user_id: ZInt64.describe('被邀请用户 QQ 号'),
121
- state: z.enum(['pending', 'accepted', 'rejected', 'ignored']).describe('请求状态'),
122
- operator_id: ZInt64.optional().describe('处理请求的管理员 QQ 号'),
123
- }).describe('群成员邀请他人入群请求'),
124
- ]).describe('群通知实体');
125
-
126
- export type FriendCategoryEntity = z.infer<typeof FriendCategoryEntity>;
127
- export type FriendEntity = z.infer<typeof FriendEntity>;
128
- export type GroupEntity = z.infer<typeof GroupEntity>;
129
- export type GroupMemberEntity = z.infer<typeof GroupMemberEntity>;
130
- export type GroupAnnouncementEntity = z.infer<typeof GroupAnnouncementEntity>;
131
- export type GroupFileEntity = z.infer<typeof GroupFileEntity>;
132
- export type GroupFolderEntity = z.infer<typeof GroupFolderEntity>;
133
- export type FriendRequest = z.infer<typeof FriendRequest>;
134
- export type GroupNotification = z.infer<typeof GroupNotification>;
package/src/constants.ts DELETED
@@ -1 +0,0 @@
1
- export const milkyVersion = '1.0';
package/src/event.ts DELETED
@@ -1,279 +0,0 @@
1
- import { z } from 'zod';
2
- import { ZInt32, ZInt64, ZString, ZBoolean } from './scalar';
3
- import { IncomingMessage } from './message';
4
-
5
- export const BotOfflineEvent = z.object({
6
- reason: ZString.describe('下线原因'),
7
- }).describe('机器人离线事件');
8
-
9
- export const MessageRecallEvent = z.object({
10
- message_scene: z.enum(['friend', 'group', 'temp']).describe('消息场景'),
11
- peer_id: ZInt64.describe('好友 QQ 号或群号'),
12
- message_seq: ZInt64.describe('消息序列号'),
13
- sender_id: ZInt64.describe('被撤回的消息的发送者 QQ 号'),
14
- operator_id: ZInt64.describe('操作者 QQ 号'),
15
- }).describe('消息撤回事件');
16
-
17
- export const FriendRequestEvent = z.object({
18
- initiator_id: ZInt64.describe('申请好友的用户 QQ 号'),
19
- initiator_uid: ZString.describe('用户 UID'),
20
- comment: ZString.describe('申请附加信息'),
21
- via: ZString.describe('申请来源'),
22
- }).describe('好友请求事件');
23
-
24
- export const GroupJoinRequestEvent = z.object({
25
- group_id: ZInt64.describe('群号'),
26
- notification_seq: ZInt64.describe('请求对应的通知序列号'),
27
- is_filtered: ZBoolean.describe('请求是否被过滤(发起自风险账户)'),
28
- initiator_id: ZInt64.describe('申请入群的用户 QQ 号'),
29
- comment: ZString.describe('申请附加信息'),
30
- }).describe('入群申请事件');
31
-
32
- export const GroupInvitedJoinRequestEvent = z.object({
33
- group_id: ZInt64.describe('群号'),
34
- notification_seq: ZInt64.describe('请求对应的通知序列号'),
35
- initiator_id: ZInt64.describe('邀请者 QQ 号'),
36
- target_user_id: ZInt64.describe('被邀请者 QQ 号'),
37
- }).describe('群成员邀请他人入群事件');
38
-
39
- export const GroupInvitationEvent = z.object({
40
- group_id: ZInt64.describe('群号'),
41
- invitation_seq: ZInt64.describe('邀请序列号'),
42
- initiator_id: ZInt64.describe('邀请者 QQ 号'),
43
- }).describe('他人邀请自身入群事件');
44
-
45
- export const FriendNudgeEvent = z.object({
46
- user_id: ZInt64.describe('好友 QQ 号'),
47
- is_self_send: ZBoolean.describe('是否是自己发送的戳一戳'),
48
- is_self_receive: ZBoolean.describe('是否是自己接收的戳一戳'),
49
- }).describe('好友戳一戳事件');
50
-
51
- export const FriendFileUploadEvent = z.object({
52
- user_id: ZInt64.describe('好友 QQ 号'),
53
- file_id: ZString.describe('文件 ID'),
54
- file_name: ZString.describe('文件名称'),
55
- file_size: ZInt64.describe('文件大小'),
56
- file_hash: ZString.describe('文件的 TriSHA1 哈希值'),
57
- is_self: ZBoolean.describe('是否是自己发送的文件'),
58
- }).describe('好友文件上传事件');
59
-
60
- export const GroupAdminChangeEvent = z.object({
61
- group_id: ZInt64.describe('群号'),
62
- user_id: ZInt64.describe('发生变更的用户 QQ 号'),
63
- is_set: ZBoolean.describe('是否被设置为管理员,`false` 表示被取消管理员'),
64
- }).describe('群管理员变更事件');
65
-
66
- export const GroupEssenceMessageChangeEvent = z.object({
67
- group_id: ZInt64.describe('群号'),
68
- message_seq: ZInt64.describe('发生变更的消息序列号'),
69
- is_set: ZBoolean.describe('是否被设置为精华,`false` 表示被取消精华'),
70
- }).describe('群精华消息变更事件');
71
-
72
- export const GroupMemberIncreaseEvent = z.object({
73
- group_id: ZInt64.describe('群号'),
74
- user_id: ZInt64.describe('发生变更的用户 QQ 号'),
75
- operator_id: ZInt64.optional().describe('管理员 QQ 号,如果是管理员同意入群'),
76
- invitor_id: ZInt64.optional().describe('邀请者 QQ 号,如果是邀请入群'),
77
- }).describe('群成员增加事件');
78
-
79
- export const GroupMemberDecreaseEvent = z.object({
80
- group_id: ZInt64.describe('群号'),
81
- user_id: ZInt64.describe('发生变更的用户 QQ 号'),
82
- operator_id: ZInt64.optional().describe('管理员 QQ 号,如果是管理员踢出'),
83
- }).describe('群成员减少事件');
84
-
85
- export const GroupNameChangeEvent = z.object({
86
- group_id: ZInt64.describe('群号'),
87
- new_group_name: ZString.describe('新的群名称'),
88
- operator_id: ZInt64.describe('操作者 QQ 号'),
89
- }).describe('群名称变更事件');
90
-
91
- export const GroupMessageReactionEvent = z.object({
92
- group_id: ZInt64.describe('群号'),
93
- user_id: ZInt64.describe('发送回应者 QQ 号'),
94
- message_seq: ZInt64.describe('消息序列号'),
95
- face_id: ZString.describe('表情 ID'),
96
- is_add: ZBoolean.describe('是否为添加,`false` 表示取消回应'),
97
- }).describe('群消息回应事件');
98
-
99
- export const GroupMuteEvent = z.object({
100
- group_id: ZInt64.describe('群号'),
101
- user_id: ZInt64.describe('发生变更的用户 QQ 号'),
102
- operator_id: ZInt64.describe('操作者 QQ 号'),
103
- duration: ZInt32.describe('禁言时长(秒),为 0 表示取消禁言'),
104
- }).describe('群禁言事件');
105
-
106
- export const GroupWholeMuteEvent = z.object({
107
- group_id: ZInt64.describe('群号'),
108
- operator_id: ZInt64.describe('操作者 QQ 号'),
109
- is_mute: ZBoolean.describe('是否全员禁言,`false` 表示取消全员禁言'),
110
- }).describe('群全体禁言事件');
111
-
112
- export const GroupNudgeEvent = z.object({
113
- group_id: ZInt64.describe('群号'),
114
- sender_id: ZInt64.describe('发送者 QQ 号'),
115
- receiver_id: ZInt64.describe('接收者 QQ 号'),
116
- }).describe('群戳一戳事件');
117
-
118
- export const GroupFileUploadEvent = z.object({
119
- group_id: ZInt64.describe('群号'),
120
- user_id: ZInt64.describe('发送者 QQ 号'),
121
- file_id: ZString.describe('文件 ID'),
122
- file_name: ZString.describe('文件名称'),
123
- file_size: ZInt64.describe('文件大小'),
124
- }).describe('群文件上传事件');
125
-
126
- export const Event = z.discriminatedUnion('event_type', [
127
- z.object({
128
- event_type: z.literal('bot_offline'),
129
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
130
- self_id: ZInt64.describe('机器人 QQ 号'),
131
- data: BotOfflineEvent,
132
- }).describe('机器人离线事件'),
133
-
134
- z.object({
135
- event_type: z.literal('message_receive'),
136
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
137
- self_id: ZInt64.describe('机器人 QQ 号'),
138
- data: IncomingMessage,
139
- }).describe('消息接收事件'),
140
-
141
- z.object({
142
- event_type: z.literal('message_recall'),
143
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
144
- self_id: ZInt64.describe('机器人 QQ 号'),
145
- data: MessageRecallEvent,
146
- }).describe('消息撤回事件'),
147
-
148
- z.object({
149
- event_type: z.literal('friend_request'),
150
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
151
- self_id: ZInt64.describe('机器人 QQ 号'),
152
- data: FriendRequestEvent,
153
- }).describe('好友请求事件'),
154
-
155
- z.object({
156
- event_type: z.literal('group_join_request'),
157
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
158
- self_id: ZInt64.describe('机器人 QQ 号'),
159
- data: GroupJoinRequestEvent,
160
- }).describe('入群请求事件'),
161
-
162
- z.object({
163
- event_type: z.literal('group_invited_join_request'),
164
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
165
- self_id: ZInt64.describe('机器人 QQ 号'),
166
- data: GroupInvitedJoinRequestEvent,
167
- }).describe('群成员邀请他人入群请求事件'),
168
-
169
- z.object({
170
- event_type: z.literal('group_invitation'),
171
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
172
- self_id: ZInt64.describe('机器人 QQ 号'),
173
- data: GroupInvitationEvent,
174
- }).describe('他人邀请自身入群事件'),
175
-
176
- z.object({
177
- event_type: z.literal('friend_nudge'),
178
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
179
- self_id: ZInt64.describe('机器人 QQ 号'),
180
- data: FriendNudgeEvent,
181
- }).describe('好友戳一戳事件'),
182
-
183
- z.object({
184
- event_type: z.literal('friend_file_upload'),
185
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
186
- self_id: ZInt64.describe('机器人 QQ 号'),
187
- data: FriendFileUploadEvent,
188
- }).describe('好友文件上传事件'),
189
-
190
- z.object({
191
- event_type: z.literal('group_admin_change'),
192
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
193
- self_id: ZInt64.describe('机器人 QQ 号'),
194
- data: GroupAdminChangeEvent,
195
- }).describe('群管理员变更事件'),
196
-
197
- z.object({
198
- event_type: z.literal('group_essence_message_change'),
199
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
200
- self_id: ZInt64.describe('机器人 QQ 号'),
201
- data: GroupEssenceMessageChangeEvent,
202
- }).describe('群精华消息变更事件'),
203
-
204
- z.object({
205
- event_type: z.literal('group_member_increase'),
206
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
207
- self_id: ZInt64.describe('机器人 QQ 号'),
208
- data: GroupMemberIncreaseEvent,
209
- }).describe('群成员增加事件'),
210
-
211
- z.object({
212
- event_type: z.literal('group_member_decrease'),
213
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
214
- self_id: ZInt64.describe('机器人 QQ 号'),
215
- data: GroupMemberDecreaseEvent,
216
- }).describe('群成员减少事件'),
217
-
218
- z.object({
219
- event_type: z.literal('group_name_change'),
220
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
221
- self_id: ZInt64.describe('机器人 QQ 号'),
222
- data: GroupNameChangeEvent,
223
- }).describe('群名称变更事件'),
224
-
225
- z.object({
226
- event_type: z.literal('group_message_reaction'),
227
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
228
- self_id: ZInt64.describe('机器人 QQ 号'),
229
- data: GroupMessageReactionEvent,
230
- }).describe('群消息表情回应事件'),
231
-
232
- z.object({
233
- event_type: z.literal('group_mute'),
234
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
235
- self_id: ZInt64.describe('机器人 QQ 号'),
236
- data: GroupMuteEvent,
237
- }).describe('群禁言事件'),
238
-
239
- z.object({
240
- event_type: z.literal('group_whole_mute'),
241
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
242
- self_id: ZInt64.describe('机器人 QQ 号'),
243
- data: GroupWholeMuteEvent,
244
- }).describe('群全体禁言事件'),
245
-
246
- z.object({
247
- event_type: z.literal('group_nudge'),
248
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
249
- self_id: ZInt64.describe('机器人 QQ 号'),
250
- data: GroupNudgeEvent,
251
- }).describe('群戳一戳事件'),
252
-
253
- z.object({
254
- event_type: z.literal('group_file_upload'),
255
- time: ZInt64.describe('事件 Unix 时间戳(秒)'),
256
- self_id: ZInt64.describe('机器人 QQ 号'),
257
- data: GroupFileUploadEvent,
258
- }).describe('群文件上传事件'),
259
- ]).describe('事件');
260
-
261
- export type BotOfflineEvent = z.infer<typeof BotOfflineEvent>;
262
- export type MessageRecallEvent = z.infer<typeof MessageRecallEvent>;
263
- export type FriendRequestEvent = z.infer<typeof FriendRequestEvent>;
264
- export type GroupJoinRequestEvent = z.infer<typeof GroupJoinRequestEvent>;
265
- export type GroupInvitedJoinRequestEvent = z.infer<typeof GroupInvitedJoinRequestEvent>;
266
- export type GroupInvitationEvent = z.infer<typeof GroupInvitationEvent>;
267
- export type FriendNudgeEvent = z.infer<typeof FriendNudgeEvent>;
268
- export type FriendFileUploadEvent = z.infer<typeof FriendFileUploadEvent>;
269
- export type GroupAdminChangeEvent = z.infer<typeof GroupAdminChangeEvent>;
270
- export type GroupEssenceMessageChangeEvent = z.infer<typeof GroupEssenceMessageChangeEvent>;
271
- export type GroupMemberIncreaseEvent = z.infer<typeof GroupMemberIncreaseEvent>;
272
- export type GroupMemberDecreaseEvent = z.infer<typeof GroupMemberDecreaseEvent>;
273
- export type GroupNameChangeEvent = z.infer<typeof GroupNameChangeEvent>;
274
- export type GroupMessageReactionEvent = z.infer<typeof GroupMessageReactionEvent>;
275
- export type GroupMuteEvent = z.infer<typeof GroupMuteEvent>;
276
- export type GroupWholeMuteEvent = z.infer<typeof GroupWholeMuteEvent>;
277
- export type GroupNudgeEvent = z.infer<typeof GroupNudgeEvent>;
278
- export type GroupFileUploadEvent = z.infer<typeof GroupFileUploadEvent>;
279
- export type Event = z.infer<typeof Event>;
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './scalar';
2
- export * from './common';
3
- export * from './message';
4
- export * from './event';
5
- export * from './api';