koishi-plugin-forward-hime 1.3.1 → 1.3.2
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/README.md +30 -30
- package/lib/index.js +24 -8
- package/package.json +72 -72
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<img src="https://socialify.git.ci/Nigh/forward-hime/image?description=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2FNigh%2Fforward-hime%2Fmain%2Fassets%2Flogo.png&name=1&pattern=Plus&theme=Auto" alt="forward-hime" width="640" height="320" />
|
|
3
|
-
|
|
4
|
-
# [Koishi](https://koishi.chat) 多群组消息互通插件
|
|
5
|
-
|
|
6
|
-
[](https://www.npmjs.com/package/koishi-plugin-forward-hime)
|
|
7
|
-
|
|
8
|
-
</div>
|
|
9
|
-
|
|
10
|
-
## Screenshot
|
|
11
|
-
|
|
12
|
-

|
|
13
|
-
|
|
14
|
-
## 安装
|
|
15
|
-
|
|
16
|
-
在 Koishi WebUI 或 Koishi 桌面应用中,打开插件市场,搜索 `forward-hime`,找到本插件后,点击 `添加` 按钮后点击 `安装` 即可。
|
|
17
|
-
|
|
18
|
-
## 配置
|
|
19
|
-
|
|
20
|
-
在插件配置页面中,可以添加 `互通转发组`。然后需要为 `互通转发组` 配置转发节点。每个转发节点对应某个平台的一个频道或群组。
|
|
21
|
-
|
|
22
|
-
可以配置多个 `互通转发组`,每个 `互通转发组` 之间相互独立。
|
|
23
|
-
|
|
24
|
-
## 使用
|
|
25
|
-
|
|
26
|
-
启用插件后,当一个 `互通转发组` 中的任意节点收到消息时,插件会自动将消息转发给**这个**`互通转发组`中的其他节点。
|
|
27
|
-
|
|
28
|
-
## 贡献者
|
|
29
|
-
|
|
30
|
-
[](https://github.com/Nigh/forward-hime/graphs/contributors)
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://socialify.git.ci/Nigh/forward-hime/image?description=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2FNigh%2Fforward-hime%2Fmain%2Fassets%2Flogo.png&name=1&pattern=Plus&theme=Auto" alt="forward-hime" width="640" height="320" />
|
|
3
|
+
|
|
4
|
+
# [Koishi](https://koishi.chat) 多群组消息互通插件
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/koishi-plugin-forward-hime)
|
|
7
|
+
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
## Screenshot
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
在 Koishi WebUI 或 Koishi 桌面应用中,打开插件市场,搜索 `forward-hime`,找到本插件后,点击 `添加` 按钮后点击 `安装` 即可。
|
|
17
|
+
|
|
18
|
+
## 配置
|
|
19
|
+
|
|
20
|
+
在插件配置页面中,可以添加 `互通转发组`。然后需要为 `互通转发组` 配置转发节点。每个转发节点对应某个平台的一个频道或群组。
|
|
21
|
+
|
|
22
|
+
可以配置多个 `互通转发组`,每个 `互通转发组` 之间相互独立。
|
|
23
|
+
|
|
24
|
+
## 使用
|
|
25
|
+
|
|
26
|
+
启用插件后,当一个 `互通转发组` 中的任意节点收到消息时,插件会自动将消息转发给**这个**`互通转发组`中的其他节点。
|
|
27
|
+
|
|
28
|
+
## 贡献者
|
|
29
|
+
|
|
30
|
+
[](https://github.com/Nigh/forward-hime/graphs/contributors)
|
package/lib/index.js
CHANGED
|
@@ -79,7 +79,16 @@ var transparentPixel = import_buffer.Buffer.from(
|
|
|
79
79
|
);
|
|
80
80
|
function Decorator({ head, content }) {
|
|
81
81
|
let msg = [];
|
|
82
|
-
|
|
82
|
+
let hasImage = false;
|
|
83
|
+
for (const key in content) {
|
|
84
|
+
if (content[key].type === "image") {
|
|
85
|
+
hasImage = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
msg = msg.concat(head, (0, import_koishi3.h)("br"), content);
|
|
89
|
+
if (!hasImage) {
|
|
90
|
+
msg = msg.concat(import_koishi3.h.image(transparentPixel, "image/gif"));
|
|
91
|
+
}
|
|
83
92
|
return msg;
|
|
84
93
|
}
|
|
85
94
|
__name(Decorator, "Decorator");
|
|
@@ -100,7 +109,7 @@ function cqJsonTranslator(content, elem) {
|
|
|
100
109
|
if (json.meta && json.meta.detail_1) {
|
|
101
110
|
if (json.meta.detail_1.preview) {
|
|
102
111
|
hit += 1;
|
|
103
|
-
content.push(import_koishi4.h.image(json.meta.detail_1.preview));
|
|
112
|
+
content.push(import_koishi4.h.image(json.meta.detail_1.preview, "image/jpeg"));
|
|
104
113
|
}
|
|
105
114
|
if (json.meta.detail_1.qqdocurl) {
|
|
106
115
|
hit += 1;
|
|
@@ -124,12 +133,19 @@ function Middleware(session) {
|
|
|
124
133
|
];
|
|
125
134
|
if (platform === "QQ") {
|
|
126
135
|
for (const key in session.elements) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
136
|
+
switch (session.elements[key].type) {
|
|
137
|
+
case "forward":
|
|
138
|
+
newContent.push((0, import_koishi4.h)("span", `[CQ:转发消息]`));
|
|
139
|
+
break;
|
|
140
|
+
case "json":
|
|
141
|
+
cqJsonTranslator(newContent, session.elements[key]);
|
|
142
|
+
break;
|
|
143
|
+
case "mface":
|
|
144
|
+
newContent.push(import_koishi4.h.image(session.elements[key].attrs.url));
|
|
145
|
+
break;
|
|
146
|
+
default:
|
|
147
|
+
newContent.push(session.elements[key]);
|
|
148
|
+
break;
|
|
133
149
|
}
|
|
134
150
|
}
|
|
135
151
|
return { head, content: newContent };
|
package/package.json
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "koishi-plugin-forward-hime",
|
|
3
|
-
"description": "多群组消息互通",
|
|
4
|
-
"version": "1.3.
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "xianii",
|
|
7
|
-
"email": "jiyucheng007@gmail.com"
|
|
8
|
-
},
|
|
9
|
-
"main": "lib/index.js",
|
|
10
|
-
"typings": "lib/index.d.ts",
|
|
11
|
-
"files": [
|
|
12
|
-
"lib"
|
|
13
|
-
],
|
|
14
|
-
"koishi": {
|
|
15
|
-
"browser": true
|
|
16
|
-
},
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"homepage": "https://nigh.github.io/forward-hime/",
|
|
19
|
-
"repository": {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/Nigh/forward-hime.git"
|
|
22
|
-
},
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://github.com/Nigh/forward-hime/issues"
|
|
25
|
-
},
|
|
26
|
-
"keywords": [
|
|
27
|
-
"chatbot",
|
|
28
|
-
"koishi",
|
|
29
|
-
"plugin",
|
|
30
|
-
"koishi-plugin",
|
|
31
|
-
"forward",
|
|
32
|
-
"message-forwarding"
|
|
33
|
-
],
|
|
34
|
-
"peerDependencies": {
|
|
35
|
-
"koishi": "^4.17.8"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^7.13.0",
|
|
39
|
-
"@typescript-eslint/parser": "^7.13.0",
|
|
40
|
-
"atsc": "^2.1.0",
|
|
41
|
-
"eslint": "^9.4.0",
|
|
42
|
-
"eslint-config-prettier": "^9.1.0",
|
|
43
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
44
|
-
"eslint-plugin-unused-imports": "^4.0.0",
|
|
45
|
-
"husky": "^9.0.11",
|
|
46
|
-
"lint-staged": "^15.2.7",
|
|
47
|
-
"prettier": "^3.3.2",
|
|
48
|
-
"typescript": "^5.4.5"
|
|
49
|
-
},
|
|
50
|
-
"scripts": {
|
|
51
|
-
"prepare": "husky",
|
|
52
|
-
"build": "atsc -b",
|
|
53
|
-
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
|
54
|
-
"format": "prettier --write .",
|
|
55
|
-
"pub": "npm publish --access public"
|
|
56
|
-
},
|
|
57
|
-
"husky": {
|
|
58
|
-
"hooks": {
|
|
59
|
-
"pre-commit": "lint-staged"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"lint-staged": {
|
|
63
|
-
"*.{js,jsx,ts,tsx,json,css,scss,md}": [
|
|
64
|
-
"eslint --fix",
|
|
65
|
-
"prettier --write"
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
"publishConfig": {
|
|
69
|
-
"registry": "https://registry.npmjs.org/",
|
|
70
|
-
"access": "public"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "koishi-plugin-forward-hime",
|
|
3
|
+
"description": "多群组消息互通",
|
|
4
|
+
"version": "1.3.2",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "xianii",
|
|
7
|
+
"email": "jiyucheng007@gmail.com"
|
|
8
|
+
},
|
|
9
|
+
"main": "lib/index.js",
|
|
10
|
+
"typings": "lib/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"lib"
|
|
13
|
+
],
|
|
14
|
+
"koishi": {
|
|
15
|
+
"browser": true
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"homepage": "https://nigh.github.io/forward-hime/",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/Nigh/forward-hime.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/Nigh/forward-hime/issues"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"chatbot",
|
|
28
|
+
"koishi",
|
|
29
|
+
"plugin",
|
|
30
|
+
"koishi-plugin",
|
|
31
|
+
"forward",
|
|
32
|
+
"message-forwarding"
|
|
33
|
+
],
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"koishi": "^4.17.8"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^7.13.0",
|
|
39
|
+
"@typescript-eslint/parser": "^7.13.0",
|
|
40
|
+
"atsc": "^2.1.0",
|
|
41
|
+
"eslint": "^9.4.0",
|
|
42
|
+
"eslint-config-prettier": "^9.1.0",
|
|
43
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
44
|
+
"eslint-plugin-unused-imports": "^4.0.0",
|
|
45
|
+
"husky": "^9.0.11",
|
|
46
|
+
"lint-staged": "^15.2.7",
|
|
47
|
+
"prettier": "^3.3.2",
|
|
48
|
+
"typescript": "^5.4.5"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"prepare": "husky",
|
|
52
|
+
"build": "atsc -b",
|
|
53
|
+
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
|
54
|
+
"format": "prettier --write .",
|
|
55
|
+
"pub": "npm publish --access public"
|
|
56
|
+
},
|
|
57
|
+
"husky": {
|
|
58
|
+
"hooks": {
|
|
59
|
+
"pre-commit": "lint-staged"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"lint-staged": {
|
|
63
|
+
"*.{js,jsx,ts,tsx,json,css,scss,md}": [
|
|
64
|
+
"eslint --fix",
|
|
65
|
+
"prettier --write"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"registry": "https://registry.npmjs.org/",
|
|
70
|
+
"access": "public"
|
|
71
|
+
}
|
|
72
|
+
}
|