@alemonjs/qq-bot 2.1.0-alpha.16 → 2.1.0-alpha.17

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,6 +1,6 @@
1
- import {QQBotClients} from './sdk/client.websoket.js';
2
- import {register} from './register.js';
3
- import {getQQBotConfig} from './config.js';
1
+ import { QQBotClients } from './sdk/client.websoket.js';
2
+ import { register } from './register.js';
3
+ import { getQQBotConfig } from './config.js';
4
4
 
5
5
  const start = () => {
6
6
  const config = getQQBotConfig();
@@ -19,12 +19,8 @@ const start = () => {
19
19
  'DIRECT_MESSAGE',
20
20
  'FORUMS_EVENT'
21
21
  ];
22
- const isGroupIntents = [
23
- 'GROUP_AND_C2C_EVENT'
24
- ];
25
- const pubIntents = [
26
- 'INTERACTION',
27
- ];
22
+ const isGroupIntents = ['GROUP_AND_C2C_EVENT'];
23
+ const pubIntents = ['INTERACTION'];
28
24
  const intents = [];
29
25
  if (config?.mode == 'guild') {
30
26
  if (config?.is_private) {
@@ -45,10 +41,9 @@ const start = () => {
45
41
  intents.push(...notPrivateIntents, ...isGroupIntents, ...pubIntents);
46
42
  }
47
43
  }
48
- const curI = config?.intents || intents;
49
44
  const client = new QQBotClients({
50
45
  ...config,
51
- intents: curI,
46
+ intents: config?.intents || intents,
52
47
  is_private: config?.is_private ?? false,
53
48
  sandbox: config?.sandbox ?? false,
54
49
  shard: config?.shard ?? [0, 1],
@@ -59,4 +54,4 @@ const start = () => {
59
54
  register(client);
60
55
  };
61
56
 
62
- export {start};
57
+ export { start };
package/lib/sdk/api.d.ts CHANGED
@@ -63,7 +63,7 @@ declare class QQBotAPI {
63
63
  * 1 图文 2 视频 3 语言 4 文件
64
64
  * 图片:png/jpg,视频:mp4,语音:silk
65
65
  */
66
- postRichMediaByUsers(openid: string, data: {
66
+ postRichMediaByUser(openid: string, data: {
67
67
  srv_send_msg?: boolean;
68
68
  file_type: FileType;
69
69
  url?: string;
@@ -73,49 +73,15 @@ declare class QQBotAPI {
73
73
  file_info: string;
74
74
  ttl: number;
75
75
  }>;
76
- /**
77
- * 发送私聊富媒体文件
78
- * @param openid
79
- * @param data
80
- * @returns
81
- * 1 图文 2 视频 3 语言 4 文件
82
- * 图片:png/jpg,视频:mp4,语音:silk
83
- */
84
- userFiles(openid: string, data: {
85
- srv_send_msg: boolean;
86
- file_type: FileType;
87
- url: string;
88
- file_data?: any;
89
- }): Promise<{
90
- file_uuid: string;
91
- file_info: string;
92
- ttl: number;
93
- }>;
94
76
  /**
95
77
  * 发送群里文件
96
- * @param openid GuildID / UserId
78
+ * @param openid
97
79
  * @param data
98
80
  * @returns
99
81
  * 1 图文 2 视频 3 语言 4 文件
100
82
  * 图片:png/jpg,视频:mp4,语音:silk
101
83
  */
102
- postRichMediaById(openid: string, data: {
103
- srv_send_msg?: boolean;
104
- file_type: FileType;
105
- url?: string;
106
- file_data?: any;
107
- }): Promise<{
108
- file_uuid: string;
109
- file_info: string;
110
- ttl: number;
111
- }>;
112
- /**
113
- *
114
- * @param openid
115
- * @param data
116
- * @returns
117
- */
118
- groupsFiles(openid: string, data: {
84
+ postRichMediaByGroup(openid: string, data: {
119
85
  srv_send_msg?: boolean;
120
86
  file_type: FileType;
121
87
  url?: string;
package/lib/sdk/api.js CHANGED
@@ -150,22 +150,7 @@ class QQBotAPI {
150
150
  * 1 图文 2 视频 3 语言 4 文件
151
151
  * 图片:png/jpg,视频:mp4,语音:silk
152
152
  */
153
- async postRichMediaByUsers(openid, data) {
154
- return this.groupService({
155
- url: `/v2/users/${openid}/files`,
156
- method: 'post',
157
- data: data
158
- }).then(res => res?.data);
159
- }
160
- /**
161
- * 发送私聊富媒体文件
162
- * @param openid
163
- * @param data
164
- * @returns
165
- * 1 图文 2 视频 3 语言 4 文件
166
- * 图片:png/jpg,视频:mp4,语音:silk
167
- */
168
- async userFiles(openid, data) {
153
+ async postRichMediaByUser(openid, data) {
169
154
  return this.groupService({
170
155
  url: `/v2/users/${openid}/files`,
171
156
  method: 'post',
@@ -174,29 +159,13 @@ class QQBotAPI {
174
159
  }
175
160
  /**
176
161
  * 发送群里文件
177
- * @param openid GuildID / UserId
162
+ * @param openid
178
163
  * @param data
179
164
  * @returns
180
165
  * 1 图文 2 视频 3 语言 4 文件
181
166
  * 图片:png/jpg,视频:mp4,语音:silk
182
167
  */
183
- async postRichMediaById(openid, data) {
184
- return this.groupService({
185
- url: `/v2/groups/${openid}/files`,
186
- method: 'post',
187
- data: {
188
- srv_send_msg: false,
189
- ...data
190
- }
191
- }).then(res => res?.data);
192
- }
193
- /**
194
- *
195
- * @param openid
196
- * @param data
197
- * @returns
198
- */
199
- async groupsFiles(openid, data) {
168
+ async postRichMediaByGroup(openid, data) {
200
169
  return this.groupService({
201
170
  url: `/v2/groups/${openid}/files`,
202
171
  method: 'post',
package/lib/sends.js CHANGED
@@ -282,7 +282,7 @@ const GROUP_AT_MESSAGE_CREATE = async (client, event, val) => {
282
282
  const getFileBase64 = () => readFileSync(item.value, 'base64');
283
283
  const file_data = item.type == 'ImageFile' ? getFileBase64() : item.value;
284
284
  const file_info = await client
285
- .postRichMediaById(event.ChannelId, {
285
+ .postRichMediaByGroup(event.ChannelId, {
286
286
  file_type: 1,
287
287
  file_data: file_data
288
288
  })
@@ -442,7 +442,7 @@ const C2C_MESSAGE_CREATE = async (client, event, val) => {
442
442
  const getFileBase64 = () => readFileSync(item.value, 'base64');
443
443
  const file_data = item.type == 'ImageFile' ? getFileBase64() : item.value;
444
444
  const file_info = await client
445
- .postRichMediaById(event.UserId, {
445
+ .postRichMediaByUser(event.UserId, {
446
446
  file_type: 1,
447
447
  file_data: file_data
448
448
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/qq-bot",
3
- "version": "2.1.0-alpha.16",
3
+ "version": "2.1.0-alpha.17",
4
4
  "description": "阿柠檬qqbot平台连接",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",