node-karin 0.12.6 → 0.12.8
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/api/npm.js
CHANGED
|
@@ -21,7 +21,7 @@ export async function getNpmPlugins(showDetails) {
|
|
|
21
21
|
list.push(name);
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
|
-
|
|
24
|
+
console.error(`[common] 解析 package.json 时出错:${error.stack || error.message || JSON.stringify(error)}`);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
await Promise.all(dependencies.map(readPackageJson));
|
|
@@ -42,7 +42,7 @@ export async function getNpmPlugins(showDetails) {
|
|
|
42
42
|
if (pkg?.karin?.apps?.length) {
|
|
43
43
|
pkg.karin.apps.forEach((app) => {
|
|
44
44
|
if (!fs.existsSync(path.join(root, app))) {
|
|
45
|
-
|
|
45
|
+
console.error(`[common] npm插件${files}的app目录${app}不存在 已跳过`);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
fs.readdirSync(path.join(root, app)).forEach((filename) => {
|
|
@@ -55,7 +55,7 @@ export async function getNpmPlugins(showDetails) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
catch (error) {
|
|
58
|
-
|
|
58
|
+
console.error(`[common] 获取npm插件列表时出错:${error.stack || error.message || JSON.stringify(error)}`);
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
await Promise.all(dependencies.map(readPackageJson));
|
|
@@ -72,7 +72,7 @@ export class Listeners extends EventEmitter {
|
|
|
72
72
|
logger.error(e);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const result = await sendForwardMessage(contact, elements);
|
|
75
|
+
const result = await sendForwardMessage.call(data.bot, contact, elements);
|
|
76
76
|
return result;
|
|
77
77
|
};
|
|
78
78
|
logger.debug('注册', this.list);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ElementType = 'text' | 'at' | 'face' | 'bubble_face' | 'reply' | 'image' | 'video' | 'basketball' | 'dice' | 'rps' | 'poke' | 'music' | 'weather' | 'location' | 'share' | 'gift' | 'market_face' | 'forward' | 'contact' | 'json' | 'xml' | 'file' | 'markdown' | 'markdown_tpl' | 'keyboard' | 'node' | 'rows' | 'record' | 'long_msg' | 'raw';
|
|
1
|
+
export type ElementType = 'text' | 'at' | 'face' | 'bubble_face' | 'reply' | 'image' | 'video' | 'basketball' | 'dice' | 'rps' | 'poke' | 'music' | 'weather' | 'location' | 'share' | 'gift' | 'market_face' | 'forward' | 'contact' | 'json' | 'xml' | 'file' | 'markdown' | 'markdown_tpl' | 'keyboard' | 'node' | 'rows' | 'record' | 'long_msg' | 'raw' | 'passive_reply';
|
|
2
2
|
export interface Element {
|
|
3
3
|
/**
|
|
4
4
|
* - 元素类型
|
|
@@ -552,6 +552,13 @@ export interface LongMsgElement extends Element {
|
|
|
552
552
|
*/
|
|
553
553
|
id: string;
|
|
554
554
|
}
|
|
555
|
+
/**
|
|
556
|
+
* - 回复被动消息 键入此字段代表此条消息为被动消息
|
|
557
|
+
*/
|
|
558
|
+
export interface PassiveElement extends Element {
|
|
559
|
+
type: 'passive_reply';
|
|
560
|
+
id: string;
|
|
561
|
+
}
|
|
555
562
|
/**
|
|
556
563
|
* 原生元素
|
|
557
564
|
*/
|
|
@@ -559,7 +566,7 @@ export interface RawElement extends Element {
|
|
|
559
566
|
type: 'raw';
|
|
560
567
|
data: any;
|
|
561
568
|
}
|
|
562
|
-
export type KarinElement = TextElement | AtElement | FaceElement | BubbleFaceElement | ReplyElement | ImageElement | VideoElement | BasketballElement | DiceElement | RpsElement | PokeElement | MusicElement | WeatherElement | LocationElement | ShareElement | GiftElement | MarketFaceElement | ForwardElement | ContactElement | JsonElement | XmlElement | FileElement | ButtonElement | KeyBoardElement | RecordElement | LongMsgElement | TplMarkdownElement | RawMarkdownElement | RawElement;
|
|
569
|
+
export type KarinElement = TextElement | AtElement | FaceElement | BubbleFaceElement | ReplyElement | ImageElement | VideoElement | BasketballElement | DiceElement | RpsElement | PokeElement | MusicElement | WeatherElement | LocationElement | ShareElement | GiftElement | MarketFaceElement | ForwardElement | ContactElement | JsonElement | XmlElement | FileElement | ButtonElement | KeyBoardElement | RecordElement | LongMsgElement | TplMarkdownElement | RawMarkdownElement | RawElement | PassiveElement;
|
|
563
570
|
/**
|
|
564
571
|
* - 构建自定义转发节点 此元素仅可通过专用接口发送 不支持混合发送
|
|
565
572
|
*/
|
|
@@ -2,11 +2,19 @@
|
|
|
2
2
|
* - 事件来源枚举
|
|
3
3
|
*/
|
|
4
4
|
export declare const enum Scene {
|
|
5
|
+
/** 群 */
|
|
5
6
|
Group = "group",
|
|
7
|
+
/** 好友 */
|
|
6
8
|
Private = "friend",
|
|
9
|
+
/** 频道 */
|
|
7
10
|
Guild = "guild",
|
|
11
|
+
/** 频道私信 */
|
|
12
|
+
GuildPrivate = "guild_private",
|
|
13
|
+
/** 临时会话 */
|
|
8
14
|
Nearby = "nearby",
|
|
15
|
+
/** 陌生人 */
|
|
9
16
|
Stranger = "stranger",
|
|
17
|
+
/** 临时群会话 */
|
|
10
18
|
StrangerFromGroup = "stranger_from_group"
|
|
11
19
|
}
|
|
12
20
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-karin",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "基于 Kritor 进行开发的nodejs机器人框架",
|
|
6
6
|
"homepage": "https://github.com/KarinJS/Karin",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
],
|
|
119
119
|
"scripts": {
|
|
120
120
|
".": "node lib/cli/start.js .",
|
|
121
|
-
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json
|
|
121
|
+
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
|
|
122
122
|
"build:npm": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
|
|
123
123
|
"dev": "node lib/cli/start.js dev",
|
|
124
124
|
"fix": "eslint lib/**/*.js --fix",
|