@alemonjs/onebot 2.1.0-alpha.12 → 2.1.0-alpha.13

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/index.js CHANGED
@@ -42,7 +42,7 @@ const main = () => {
42
42
  const UserAvatar = createUserAvatar(UserId);
43
43
  const [isMaster, UserKey] = getMaster(UserId);
44
44
  const groupId = String(event.group_id);
45
- const readyId = event.message.find(item => item.type === 'reply')?.data?.id;
45
+ const replyId = event.message.find(item => item.type === 'reply')?.data?.id;
46
46
  const e = {
47
47
  name: 'message.create',
48
48
  Platform: platform,
@@ -58,7 +58,7 @@ const main = () => {
58
58
  MessageId: String(event.message_id),
59
59
  MessageText: msg.trim(),
60
60
  OpenId: UserId,
61
- readyId,
61
+ replyId,
62
62
  CreateAt: Date.now(),
63
63
  tag: 'message.create',
64
64
  value: event
@@ -70,7 +70,7 @@ const main = () => {
70
70
  const UserId = String(event.user_id);
71
71
  const UserAvatar = createUserAvatar(UserId);
72
72
  const [isMaster, UserKey] = getMaster(UserId);
73
- const readyId = event.message.find(item => item.type === 'reply')?.data?.id;
73
+ const replyId = event.message.find(item => item.type === 'reply')?.data?.id;
74
74
  const e = {
75
75
  name: 'private.message.create',
76
76
  Platform: platform,
@@ -84,7 +84,7 @@ const main = () => {
84
84
  MessageText: msg.trim(),
85
85
  OpenId: String(event.user_id),
86
86
  CreateAt: Date.now(),
87
- readyId,
87
+ replyId,
88
88
  tag: 'private.message.create',
89
89
  value: event
90
90
  };
package/lib/sdk/api.d.ts CHANGED
@@ -16,14 +16,68 @@ export declare class OneBotAPI {
16
16
  user_id?: number;
17
17
  message: any[];
18
18
  }): Promise<any>;
19
- getLoginInfo(): Promise<any>;
19
+ deleteMsg(options: {
20
+ message_id: number;
21
+ }): Promise<any>;
20
22
  getMsg(options: {
21
23
  message_id: number;
22
24
  }): Promise<any>;
23
- getFriendList(): Promise<any>;
24
- getGroupList(): Promise<any>;
25
- getGroupMemberList(options: {
25
+ getForwardMsg(options: {
26
+ id: string;
27
+ }): Promise<any>;
28
+ sendLike(options: {
29
+ user_id: number;
30
+ times?: number;
31
+ }): Promise<any>;
32
+ setGroupKick(options: {
26
33
  group_id: number;
34
+ user_id: number;
35
+ reject_add_request?: boolean;
36
+ }): Promise<any>;
37
+ setGroupBan(options: {
38
+ group_id: number;
39
+ user_id: number;
40
+ duration: number;
41
+ }): Promise<any>;
42
+ setGroupAnonymousBan(options: {
43
+ group_id: number;
44
+ anonymous: {
45
+ id: string;
46
+ name: string;
47
+ };
48
+ duration: number;
49
+ }): Promise<any>;
50
+ setGroupWholeBan(options: {
51
+ group_id: number;
52
+ enable: boolean;
53
+ }): Promise<any>;
54
+ setGroupAdmin(options: {
55
+ group_id: number;
56
+ user_id: number;
57
+ enable: boolean;
58
+ }): Promise<any>;
59
+ setGroupAnonymous(options: {
60
+ group_id: number;
61
+ enable: boolean;
62
+ }): Promise<any>;
63
+ setGroupCard(options: {
64
+ group_id: number;
65
+ user_id: number;
66
+ card: string;
67
+ }): Promise<any>;
68
+ setGroupName(options: {
69
+ group_id: number;
70
+ group_name: string;
71
+ }): Promise<any>;
72
+ setGroupLeave(options: {
73
+ group_id: number;
74
+ is_dismiss?: boolean;
75
+ }): Promise<any>;
76
+ setGroupSpecialTitle(options: {
77
+ group_id: number;
78
+ user_id: number;
79
+ special_title: string;
80
+ duration: number;
27
81
  }): Promise<any>;
28
82
  setFriendAddRequest(options: {
29
83
  flag: string;
@@ -36,9 +90,44 @@ export declare class OneBotAPI {
36
90
  approve: boolean;
37
91
  reason?: string;
38
92
  }): Promise<any>;
39
- deleteMsg(options: {
40
- message_id: number;
93
+ getLoginInfo(): Promise<any>;
94
+ getStrangerInfo(options: {
95
+ user_id: number;
96
+ no_cache?: boolean;
97
+ }): Promise<any>;
98
+ getFriendList(): Promise<any>;
99
+ getGroupInfo(params?: {
100
+ group_id: number;
101
+ no_cache?: boolean;
102
+ }): Promise<any>;
103
+ getGroupList(): Promise<any>;
104
+ getGroupMemberInfo(options: {
105
+ group_id: number;
106
+ user_id: number;
107
+ no_cache?: boolean;
108
+ }): Promise<any>;
109
+ getGroupMemberList(options: {
110
+ group_id: number;
111
+ }): Promise<any>;
112
+ getGroupHonorInfo(options: {
113
+ group_id: number;
114
+ type: 'talkative' | 'performer' | 'legend' | 'strong_newbie';
115
+ }): Promise<any>;
116
+ getCookies(): Promise<any>;
117
+ getCsrfToken(): Promise<any>;
118
+ getCredentials(): Promise<any>;
119
+ getRecord(options: {
120
+ file: string;
121
+ }): Promise<any>;
122
+ getImage(options: {
123
+ file: string;
41
124
  }): Promise<any>;
125
+ canSendImage(): Promise<any>;
126
+ canSendRecord(): Promise<any>;
127
+ getStatus(): Promise<any>;
128
+ getVersionInfo(): Promise<any>;
129
+ setRestart(): Promise<any>;
130
+ cleanCache(): Promise<any>;
42
131
  uploadPrivateFile(options: {
43
132
  user_id: number;
44
133
  file: string;
package/lib/sdk/api.js CHANGED
@@ -64,6 +64,150 @@ class OneBotAPI {
64
64
  params: options
65
65
  });
66
66
  }
67
+ deleteMsg(options) {
68
+ if (!this.ws) {
69
+ return;
70
+ }
71
+ return send(this.ws, {
72
+ action: 'delete_msg',
73
+ params: options
74
+ });
75
+ }
76
+ getMsg(options) {
77
+ if (!this.ws) {
78
+ return;
79
+ }
80
+ return send(this.ws, {
81
+ action: 'get_msg',
82
+ params: options
83
+ });
84
+ }
85
+ getForwardMsg(options) {
86
+ if (!this.ws) {
87
+ return;
88
+ }
89
+ return send(this.ws, {
90
+ action: 'get_forward_msg',
91
+ params: options
92
+ });
93
+ }
94
+ sendLike(options) {
95
+ if (!this.ws) {
96
+ return;
97
+ }
98
+ return send(this.ws, {
99
+ action: 'send_like',
100
+ params: options
101
+ });
102
+ }
103
+ setGroupKick(options) {
104
+ if (!this.ws) {
105
+ return;
106
+ }
107
+ return send(this.ws, {
108
+ action: 'set_group_kick',
109
+ params: options
110
+ });
111
+ }
112
+ setGroupBan(options) {
113
+ if (!this.ws) {
114
+ return;
115
+ }
116
+ return send(this.ws, {
117
+ action: 'set_group_ban',
118
+ params: options
119
+ });
120
+ }
121
+ setGroupAnonymousBan(options) {
122
+ if (!this.ws) {
123
+ return;
124
+ }
125
+ return send(this.ws, {
126
+ action: 'set_group_anonymous_ban',
127
+ params: options
128
+ });
129
+ }
130
+ setGroupWholeBan(options) {
131
+ if (!this.ws) {
132
+ return;
133
+ }
134
+ return send(this.ws, {
135
+ action: 'set_group_whole_ban',
136
+ params: options
137
+ });
138
+ }
139
+ setGroupAdmin(options) {
140
+ if (!this.ws) {
141
+ return;
142
+ }
143
+ return send(this.ws, {
144
+ action: 'set_group_admin',
145
+ params: options
146
+ });
147
+ }
148
+ setGroupAnonymous(options) {
149
+ if (!this.ws) {
150
+ return;
151
+ }
152
+ return send(this.ws, {
153
+ action: 'set_group_anonymous',
154
+ params: options
155
+ });
156
+ }
157
+ setGroupCard(options) {
158
+ if (!this.ws) {
159
+ return;
160
+ }
161
+ return send(this.ws, {
162
+ action: 'set_group_card',
163
+ params: options
164
+ });
165
+ }
166
+ setGroupName(options) {
167
+ if (!this.ws) {
168
+ return;
169
+ }
170
+ return send(this.ws, {
171
+ action: 'set_group_name',
172
+ params: options
173
+ });
174
+ }
175
+ setGroupLeave(options) {
176
+ if (!this.ws) {
177
+ return;
178
+ }
179
+ return send(this.ws, {
180
+ action: 'set_group_leave',
181
+ params: options
182
+ });
183
+ }
184
+ setGroupSpecialTitle(options) {
185
+ if (!this.ws) {
186
+ return;
187
+ }
188
+ return send(this.ws, {
189
+ action: 'set_group_special_title',
190
+ params: options
191
+ });
192
+ }
193
+ setFriendAddRequest(options) {
194
+ if (!this.ws) {
195
+ return;
196
+ }
197
+ return send(this.ws, {
198
+ action: 'set_friend_add_request',
199
+ params: options
200
+ });
201
+ }
202
+ setGroupAddRequest(options) {
203
+ if (!this.ws) {
204
+ return;
205
+ }
206
+ return send(this.ws, {
207
+ action: 'set_group_add_request',
208
+ params: options
209
+ });
210
+ }
67
211
  getLoginInfo() {
68
212
  if (!this.ws) {
69
213
  return;
@@ -73,12 +217,12 @@ class OneBotAPI {
73
217
  params: {}
74
218
  });
75
219
  }
76
- getMsg(options) {
220
+ getStrangerInfo(options) {
77
221
  if (!this.ws) {
78
222
  return;
79
223
  }
80
224
  return send(this.ws, {
81
- action: 'get_msg',
225
+ action: 'get_stranger_info',
82
226
  params: options
83
227
  });
84
228
  }
@@ -91,6 +235,15 @@ class OneBotAPI {
91
235
  params: {}
92
236
  });
93
237
  }
238
+ getGroupInfo(params) {
239
+ if (!this.ws) {
240
+ return;
241
+ }
242
+ return send(this.ws, {
243
+ action: 'get_group_info',
244
+ params: params
245
+ });
246
+ }
94
247
  getGroupList() {
95
248
  if (!this.ws) {
96
249
  return;
@@ -100,6 +253,15 @@ class OneBotAPI {
100
253
  params: {}
101
254
  });
102
255
  }
256
+ getGroupMemberInfo(options) {
257
+ if (!this.ws) {
258
+ return;
259
+ }
260
+ return send(this.ws, {
261
+ action: 'get_group_member_info',
262
+ params: options
263
+ });
264
+ }
103
265
  getGroupMemberList(options) {
104
266
  if (!this.ws) {
105
267
  return;
@@ -109,33 +271,114 @@ class OneBotAPI {
109
271
  params: options
110
272
  });
111
273
  }
112
- setFriendAddRequest(options) {
274
+ getGroupHonorInfo(options) {
113
275
  if (!this.ws) {
114
276
  return;
115
277
  }
116
278
  return send(this.ws, {
117
- action: 'set_friend_add_request',
279
+ action: 'get_group_honor_info',
118
280
  params: options
119
281
  });
120
282
  }
121
- setGroupAddRequest(options) {
283
+ getCookies() {
122
284
  if (!this.ws) {
123
285
  return;
124
286
  }
125
287
  return send(this.ws, {
126
- action: 'set_group_add_request',
288
+ action: 'get_cookies',
289
+ params: {}
290
+ });
291
+ }
292
+ getCsrfToken() {
293
+ if (!this.ws) {
294
+ return;
295
+ }
296
+ return send(this.ws, {
297
+ action: 'get_csrf_token',
298
+ params: {}
299
+ });
300
+ }
301
+ getCredentials() {
302
+ if (!this.ws) {
303
+ return;
304
+ }
305
+ return send(this.ws, {
306
+ action: 'get_credentials',
307
+ params: {}
308
+ });
309
+ }
310
+ getRecord(options) {
311
+ if (!this.ws) {
312
+ return;
313
+ }
314
+ return send(this.ws, {
315
+ action: 'get_record',
127
316
  params: options
128
317
  });
129
318
  }
130
- deleteMsg(options) {
319
+ getImage(options) {
131
320
  if (!this.ws) {
132
321
  return;
133
322
  }
134
323
  return send(this.ws, {
135
- action: 'delete_msg',
324
+ action: 'get_image',
136
325
  params: options
137
326
  });
138
327
  }
328
+ canSendImage() {
329
+ if (!this.ws) {
330
+ return;
331
+ }
332
+ return send(this.ws, {
333
+ action: 'can_send_image',
334
+ params: {}
335
+ });
336
+ }
337
+ canSendRecord() {
338
+ if (!this.ws) {
339
+ return;
340
+ }
341
+ return send(this.ws, {
342
+ action: 'can_send_record',
343
+ params: {}
344
+ });
345
+ }
346
+ getStatus() {
347
+ if (!this.ws) {
348
+ return;
349
+ }
350
+ return send(this.ws, {
351
+ action: 'get_status',
352
+ params: {}
353
+ });
354
+ }
355
+ getVersionInfo() {
356
+ if (!this.ws) {
357
+ return;
358
+ }
359
+ return send(this.ws, {
360
+ action: 'get_version_info',
361
+ params: {}
362
+ });
363
+ }
364
+ setRestart() {
365
+ if (!this.ws) {
366
+ return;
367
+ }
368
+ return send(this.ws, {
369
+ action: 'set_restart',
370
+ params: {}
371
+ });
372
+ }
373
+ cleanCache() {
374
+ if (!this.ws) {
375
+ return;
376
+ }
377
+ return send(this.ws, {
378
+ action: 'clean_cache',
379
+ params: {}
380
+ });
381
+ }
139
382
  uploadPrivateFile(options) {
140
383
  if (!this.ws) {
141
384
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/onebot",
3
- "version": "2.1.0-alpha.12",
3
+ "version": "2.1.0-alpha.13",
4
4
  "description": "oneBot v11",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",