mirai-js 2.5.0 → 2.7.0-beta.1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/FUNDING.yml +1 -1
- package/README.md +5 -0
- package/dist/browser/mirai-js.js +1 -1
- package/dist/node/BaseType.d.ts +16 -0
- package/dist/node/Bot.d.ts +2 -2
- package/dist/node/ForwardNode.d.ts +15 -0
- package/dist/node/ForwardNode.js +70 -0
- package/dist/node/Message.d.ts +20 -1
- package/dist/node/Message.js +51 -0
- package/dist/node/core/anno/deleteAnno.js +1 -1
- package/dist/node/core/anno/getAnno.js +1 -1
- package/dist/node/core/anno/publishAnno.js +1 -1
- package/dist/node/core/auth.js +1 -1
- package/dist/node/core/fs/deleteGroupFile.js +1 -1
- package/dist/node/core/fs/getGroupFileInfo.js +1 -1
- package/dist/node/core/fs/getGroupFileList.js +1 -1
- package/dist/node/core/fs/makeGroupDir.js +1 -1
- package/dist/node/core/fs/moveGroupFile.js +1 -1
- package/dist/node/core/fs/renameGroupFile.js +1 -1
- package/dist/node/core/fs/uploadGroupFIle.js +1 -1
- package/dist/node/core/getFriendList.js +1 -1
- package/dist/node/core/getGroupConfig.js +1 -1
- package/dist/node/core/getGroupList.js +1 -1
- package/dist/node/core/getMemberInfo.js +1 -1
- package/dist/node/core/getMemberList.js +1 -1
- package/dist/node/core/getSessionConfig.js +1 -1
- package/dist/node/core/getUserProfile.js +1 -1
- package/dist/node/core/mute.js +1 -1
- package/dist/node/core/muteAll.js +1 -1
- package/dist/node/core/quitGroup.js +1 -1
- package/dist/node/core/recall.js +1 -1
- package/dist/node/core/releaseSession.js +1 -1
- package/dist/node/core/removeFriend.js +1 -1
- package/dist/node/core/removeMember.js +1 -1
- package/dist/node/core/responseBotInvitedJoinGroupRequest.js +1 -1
- package/dist/node/core/responseFirendRequest.js +1 -1
- package/dist/node/core/responseMemberJoinRequest.js +1 -1
- package/dist/node/core/sendCommand.js +1 -1
- package/dist/node/core/sendFriendMessage.js +1 -1
- package/dist/node/core/sendGroupMessage.js +1 -1
- package/dist/node/core/sendNudge.js +1 -1
- package/dist/node/core/sendTempMessage.js +1 -1
- package/dist/node/core/setEssence.js +1 -1
- package/dist/node/core/setGroupConfig.js +1 -1
- package/dist/node/core/setMemberAdmin.js +1 -1
- package/dist/node/core/setMemberInfo.js +1 -1
- package/dist/node/core/setSessionConfig.js +1 -1
- package/dist/node/core/startListeningBrowser.js +1 -1
- package/dist/node/core/startListeningNode.js +1 -1
- package/dist/node/core/stopListeningBrowser.js +1 -1
- package/dist/node/core/stopListeningNode.js +1 -1
- package/dist/node/core/unmute.js +1 -1
- package/dist/node/core/unmuteAll.js +1 -1
- package/dist/node/core/uploadImage.js +1 -1
- package/dist/node/core/uploadVoice.js +1 -1
- package/dist/node/core/verify.js +1 -1
- package/dist/node/index.d.ts +8 -3
- package/dist/node/index.js +12 -9
- package/dist/node/polyfill/URL.js +1 -1
- package/dist/node/polyfill/wsListener.js +2 -2
- package/package.json +2 -2
- package/src/BaseType.d.ts +16 -0
- package/src/Bot.d.ts +2 -2
- package/src/Message.d.ts +20 -1
- package/src/Message.js +39 -0
- package/src/core/anno/deleteAnno.js +1 -1
- package/src/core/anno/getAnno.js +1 -1
- package/src/core/anno/publishAnno.js +1 -1
- package/src/core/auth.js +1 -1
- package/src/core/fs/deleteGroupFile.js +1 -1
- package/src/core/fs/getGroupFileInfo.js +1 -1
- package/src/core/fs/getGroupFileList.js +1 -1
- package/src/core/fs/makeGroupDir.js +1 -1
- package/src/core/fs/moveGroupFile.js +1 -1
- package/src/core/fs/renameGroupFile.js +1 -1
- package/src/core/fs/uploadGroupFIle.js +1 -1
- package/src/core/getFriendList.js +1 -1
- package/src/core/getGroupConfig.js +1 -1
- package/src/core/getGroupList.js +1 -1
- package/src/core/getMemberInfo.js +1 -1
- package/src/core/getMemberList.js +1 -1
- package/src/core/getSessionConfig.js +1 -1
- package/src/core/getUserProfile.js +1 -1
- package/src/core/mute.js +1 -1
- package/src/core/muteAll.js +1 -1
- package/src/core/quitGroup.js +1 -1
- package/src/core/recall.js +1 -1
- package/src/core/releaseSession.js +1 -1
- package/src/core/removeFriend.js +1 -1
- package/src/core/removeMember.js +1 -1
- package/src/core/responseBotInvitedJoinGroupRequest.js +1 -1
- package/src/core/responseFirendRequest.js +1 -1
- package/src/core/responseMemberJoinRequest.js +1 -1
- package/src/core/sendCommand.js +1 -1
- package/src/core/sendFriendMessage.js +1 -1
- package/src/core/sendGroupMessage.js +1 -1
- package/src/core/sendNudge.js +1 -1
- package/src/core/sendTempMessage.js +1 -1
- package/src/core/setEssence.js +1 -1
- package/src/core/setGroupConfig.js +1 -1
- package/src/core/setMemberAdmin.js +1 -1
- package/src/core/setMemberInfo.js +1 -1
- package/src/core/setSessionConfig.js +1 -1
- package/src/core/startListeningBrowser.js +1 -1
- package/src/core/startListeningNode.js +1 -1
- package/src/core/stopListeningBrowser.js +1 -1
- package/src/core/stopListeningNode.js +1 -1
- package/src/core/unmute.js +1 -1
- package/src/core/unmuteAll.js +1 -1
- package/src/core/uploadImage.js +1 -1
- package/src/core/uploadVoice.js +1 -1
- package/src/core/verify.js +1 -1
- package/src/index.d.ts +8 -3
- package/src/index.js +13 -9
- package/src/polyfill/URL.js +1 -1
- package/src/polyfill/wsListener.js +2 -2
- package/.github/dependabot.yml +0 -14
package/dist/node/index.js
CHANGED
@@ -12,16 +12,19 @@ const {
|
|
12
12
|
Middleware
|
13
13
|
} = require('./Middleware');
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
(function (window, factory) {
|
16
|
+
if (typeof exports === 'object') {
|
17
|
+
module.exports = factory(); // eslint-disable-next-line no-undef
|
18
|
+
} else if (typeof define === 'function' && define.amd) {
|
19
|
+
// eslint-disable-next-line no-undef
|
20
|
+
define(factory);
|
21
|
+
} else {
|
22
|
+
window.miraiJs = factory();
|
23
|
+
}
|
24
|
+
})(void 0, function () {
|
25
|
+
return {
|
17
26
|
Bot,
|
18
27
|
Message,
|
19
28
|
Middleware
|
20
29
|
};
|
21
|
-
}
|
22
|
-
module.exports = {
|
23
|
-
Bot,
|
24
|
-
Message,
|
25
|
-
Middleware
|
26
|
-
};
|
27
|
-
}
|
30
|
+
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
module.exports = {
|
4
|
-
wsStartListening:
|
5
|
-
wsStopListening:
|
4
|
+
wsStartListening: window !== undefined ? require('../core/startListeningBrowser') : require('../core/startListeningNode'),
|
5
|
+
wsStopListening: window !== undefined ? require('../core/stopListeningBrowser') : require('../core/stopListeningNode')
|
6
6
|
};
|
package/package.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "mirai-js",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.7.0-beta.1.0.0",
|
4
4
|
"description": "QQ robot development framework based on Mirai-api-http.",
|
5
5
|
"main": "dist/node/index.js",
|
6
6
|
"scripts": {
|
7
7
|
"lint": "eslint --fix .",
|
8
|
-
"build": "webpack && babel src --out-dir dist/node --copy-files",
|
8
|
+
"build": "tsc --noEmit src/*.d.ts && webpack && babel src --out-dir dist/node --copy-files",
|
9
9
|
"prepare": "husky install"
|
10
10
|
},
|
11
11
|
"lint-staged": {
|
package/src/BaseType.d.ts
CHANGED
@@ -40,6 +40,8 @@ interface MessageType {
|
|
40
40
|
// App
|
41
41
|
content?: string;
|
42
42
|
|
43
|
+
// Forward
|
44
|
+
nodeList?: ForwardNode[];
|
43
45
|
}
|
44
46
|
|
45
47
|
// 用于 Bot 获得消息链,Message 使用了该扩展
|
@@ -47,6 +49,17 @@ interface MessageChainGetable {
|
|
47
49
|
getMessageChain(): MessageType[];
|
48
50
|
}
|
49
51
|
|
52
|
+
/**
|
53
|
+
* @description 合并转发类型Forward内消息节点的类型定义
|
54
|
+
*/
|
55
|
+
interface ForwardNode {
|
56
|
+
senderId?: number;
|
57
|
+
time?: number;
|
58
|
+
senderName?: string;
|
59
|
+
messageChain?: MessageType[] | MessageChainGetable;
|
60
|
+
messageId?: MessageId;
|
61
|
+
}
|
62
|
+
|
50
63
|
/**
|
51
64
|
* @description Bot 实现的接口,其他类访问 bot.config
|
52
65
|
* 的途径,避免其他类直接访问实现,用来解耦
|
@@ -166,6 +179,9 @@ export {
|
|
166
179
|
// 消息类型
|
167
180
|
MessageType,
|
168
181
|
|
182
|
+
// MessageType.nodeList 的元素类型
|
183
|
+
ForwardNode,
|
184
|
+
|
169
185
|
// 图片 id 语音 id 消息 id
|
170
186
|
ImageId, VoiceId, MessageId,
|
171
187
|
|
package/src/Bot.d.ts
CHANGED
@@ -55,7 +55,7 @@ export class Bot implements BotConfigGetable {
|
|
55
55
|
* @param keepProcessor 可选,是否保留事件处理器,默认值为 false,不保留
|
56
56
|
* @param keepConfig 可选,是否保留 session baseUrl qq averifyKey,默认值为 false,不保留
|
57
57
|
*/
|
58
|
-
close({ keepProcessor, keepConfig }
|
58
|
+
close({ keepProcessor, keepConfig }?: Bot.CloseOptions): Promise<void>;
|
59
59
|
|
60
60
|
/**
|
61
61
|
* ! messageChain 将在未来被移除
|
@@ -326,7 +326,7 @@ declare namespace Bot {
|
|
326
326
|
baseUrl?: string;
|
327
327
|
verifyKey?: string;
|
328
328
|
qq?: number;
|
329
|
-
singleMode
|
329
|
+
singleMode?: boolean;
|
330
330
|
}
|
331
331
|
|
332
332
|
interface CloseOptions {
|
package/src/Message.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// Message 通过实现 MessageChaingetable 与 Bot.sendMessage 通信
|
2
2
|
// 消息链元素类型和图片 id 类型
|
3
|
-
import { MessageChainGetable, MessageType, ImageId, FaceType } from './BaseType';
|
3
|
+
import { MessageChainGetable, MessageType, ImageId, FaceType, MessageId, ForwardNode, } from './BaseType';
|
4
4
|
|
5
5
|
// Bot.sendMessage 的 message 参数是一个 Message 类型的实例
|
6
6
|
// 方法内部通过 getMessageChainable 接口的 getMessageChain 方法拿到消息链
|
@@ -44,4 +44,23 @@ export class Message implements MessageChainGetable {
|
|
44
44
|
|
45
45
|
// implements MessageChainGetable
|
46
46
|
getMessageChain(): MessageType[];
|
47
|
+
|
48
|
+
// factory
|
49
|
+
static createForwardMessage(): ForwardMessage;
|
47
50
|
}
|
51
|
+
|
52
|
+
export class ForwardMessage implements MessageChainGetable {
|
53
|
+
constructor(nodeList: ForwardNode[]);
|
54
|
+
private messageChain: MessageType[];
|
55
|
+
|
56
|
+
addForwardNode({
|
57
|
+
senderId,
|
58
|
+
time,
|
59
|
+
senderName,
|
60
|
+
messageChain
|
61
|
+
}: ForwardNode): Message;
|
62
|
+
addForwardNode(messageId: MessageId): ForwardMessage;
|
63
|
+
|
64
|
+
// implements MessageChainGetable
|
65
|
+
getMessageChain(): MessageType[];
|
66
|
+
}
|
package/src/Message.js
CHANGED
@@ -98,6 +98,13 @@ class App extends MessageType {
|
|
98
98
|
}
|
99
99
|
}
|
100
100
|
|
101
|
+
class ForwardNodeList extends MessageType {
|
102
|
+
constructor({ nodeList }) {
|
103
|
+
super({ type: 'Forward' });
|
104
|
+
this.nodeList = nodeList;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
101
108
|
const faceMap = new Map([
|
102
109
|
['惊讶', 0], ['撇嘴', 1], ['色', 2], ['发呆', 3], ['得意', 4],
|
103
110
|
['流泪', 5], ['害羞', 6], ['闭嘴', 7], ['睡', 8], ['大哭', 9],
|
@@ -270,6 +277,38 @@ class Message extends MessageChainGetable {
|
|
270
277
|
getMessageChain() {
|
271
278
|
return this.messageChain;
|
272
279
|
}
|
280
|
+
|
281
|
+
static createForwardMessage() {
|
282
|
+
return new ForwardMessage();
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
class ForwardMessage extends MessageChainGetable {
|
287
|
+
constructor() {
|
288
|
+
super();
|
289
|
+
this.messageChain = [];
|
290
|
+
this.nodeList = [];
|
291
|
+
}
|
292
|
+
|
293
|
+
addForwardNode(nodeOrId) {
|
294
|
+
if (typeof nodeOrId === 'number') {
|
295
|
+
this.nodeList.push({
|
296
|
+
messageId: nodeOrId
|
297
|
+
});
|
298
|
+
} else if (typeof nodeOrId == 'object') {
|
299
|
+
if (nodeOrId.messageChain instanceof MessageChainGetable) {
|
300
|
+
nodeOrId.messageChain = nodeOrId.messageChain.getMessageChain();
|
301
|
+
}
|
302
|
+
this.nodeList.push(nodeOrId);
|
303
|
+
} /* else ignore */
|
304
|
+
return this;
|
305
|
+
}
|
306
|
+
|
307
|
+
// implements MessageChainGetable
|
308
|
+
getMessageChain() {
|
309
|
+
this.messageChain.push(new ForwardNodeList({ nodeList: this.nodeList }));
|
310
|
+
return this.messageChain;
|
311
|
+
}
|
273
312
|
}
|
274
313
|
|
275
314
|
module.exports = { Message };
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 删除群公告
|
package/src/core/anno/getAnno.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取群公告
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 发布群公告
|
package/src/core/auth.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
*
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 删除群文件
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取群文件详细信息
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取群文件列表
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 新建群文件夹
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 移动群文件
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 重命名群文件
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../../polyfill/URL');
|
4
4
|
const errorHandler = require('../../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
const FormData = require('form-data');
|
8
8
|
|
9
9
|
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取好友列表
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取群配置
|
package/src/core/getGroupList.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取群列表
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取群成员信息
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取指定群的成员列表
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取指定 session 的 config
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 获取用户信息
|
package/src/core/mute.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 禁言群成员
|
package/src/core/muteAll.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 全员禁言
|
package/src/core/quitGroup.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 退出群聊
|
package/src/core/recall.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 撤回由 messageId 确定的消息
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 关闭一个会话
|
package/src/core/removeFriend.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 删除好友
|
package/src/core/removeMember.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 移除群成员
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* ! 自动同意时,不会触发该事件
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 响应好友请求
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* FIXME: mirai-core 的问题,有时候收不到 MemberJoinRequestEvent 事件
|
package/src/core/sendCommand.js
CHANGED
@@ -3,7 +3,7 @@ const { errCodeMap } = require('../util/errCode');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 向 mirai-console 发送指令
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 向 qq 好友发送消息
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 向 qq 群发送消息
|
package/src/core/sendNudge.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 发送戳一戳消息
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 向临时对象发送消息
|
package/src/core/setEssence.js
CHANGED
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
|
9
9
|
/**
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
|
9
9
|
/**
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 设置群成员权限
|
@@ -3,7 +3,7 @@ const axios = require('axios');
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @description 设置群成员信息
|
@@ -3,7 +3,7 @@ const axios = require('axios').default;
|
|
3
3
|
const { URL } = require('../polyfill/URL');
|
4
4
|
const errorHandler = require('../util/errorHandler');
|
5
5
|
const path = require('path');
|
6
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
6
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
7
7
|
|
8
8
|
|
9
9
|
/**
|
@@ -2,7 +2,7 @@ const WebSocket = window.WebSocket;
|
|
2
2
|
const { URL } = require('../polyfill/URL');
|
3
3
|
const errorHandler = require('../util/errorHandler');
|
4
4
|
const path = require('path');
|
5
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
5
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
6
6
|
|
7
7
|
/**
|
8
8
|
* @description 开始侦听事件
|
@@ -2,7 +2,7 @@ const WebSocket = require('ws');
|
|
2
2
|
const { URL } = require('../polyfill/URL');
|
3
3
|
const errorHandler = require('../util/errorHandler');
|
4
4
|
const path = require('path');
|
5
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
5
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
6
6
|
|
7
7
|
/**
|
8
8
|
* @description 开始侦听事件
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const errorHandler = require('../util/errorHandler');
|
2
2
|
const path = require('path');
|
3
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
3
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
4
4
|
|
5
5
|
/**
|
6
6
|
* @description 停止侦听事件
|
@@ -1,6 +1,6 @@
|
|
1
1
|
const errorHandler = require('../util/errorHandler');
|
2
2
|
const path = require('path');
|
3
|
-
const locationStr = `core.${path.basename(__filename, path.extname(__filename))}
|
3
|
+
const locationStr = window === undefined ? `core.${path.basename(__filename, path.extname(__filename))}` : 'borwser';
|
4
4
|
|
5
5
|
/**
|
6
6
|
* @description 停止侦听事件
|