wechaty-web-panel 1.1.21 → 1.2.1
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/dist/cjs/src/package-json.js +1 -1
- package/dist/cjs/src/proxy/tencent-open.js +6 -11
- package/dist/cjs/src/service/msg-filters.d.ts +4 -1
- package/dist/cjs/src/service/msg-filters.js +3 -1
- package/dist/esm/src/package-json.js +1 -1
- package/dist/esm/src/proxy/tencent-open.js +6 -11
- package/dist/esm/src/service/msg-filters.d.ts +4 -1
- package/dist/esm/src/service/msg-filters.js +3 -1
- package/package.json +2 -2
|
@@ -175,9 +175,7 @@ async function getTencentOpenReply({ msg, id, userInfo }) {
|
|
|
175
175
|
const replys = [];
|
|
176
176
|
multiList.forEach((item) => {
|
|
177
177
|
item = item.replace(/<\/?.+?\/?>/g, '');
|
|
178
|
-
console.log('item', item);
|
|
179
178
|
const reply = getFormatReply(item, resData.options || [], userInfo, config.puppetType);
|
|
180
|
-
console.log('reply', reply);
|
|
181
179
|
replys.push(...reply);
|
|
182
180
|
});
|
|
183
181
|
return replys;
|
|
@@ -190,13 +188,14 @@ async function getTencentOpenReply({ msg, id, userInfo }) {
|
|
|
190
188
|
else if (resData.answer_type === 'music') {
|
|
191
189
|
// web 端协议以文字和图片的形式发送
|
|
192
190
|
if (config.puppetType === 'wechaty-puppet-wechat') {
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
const
|
|
191
|
+
const res = JSON.parse(resData.answer);
|
|
192
|
+
const music = res.news.articles[0];
|
|
193
|
+
const musicContent = `【歌名】:《${music && music.title}》\n【听歌地址】:${music && music.url}`;
|
|
194
|
+
const musicPic = music && music.picurl;
|
|
196
195
|
return [
|
|
197
196
|
{
|
|
198
197
|
type: 1,
|
|
199
|
-
content:
|
|
198
|
+
content: musicContent,
|
|
200
199
|
},
|
|
201
200
|
{
|
|
202
201
|
type: 2,
|
|
@@ -208,11 +207,7 @@ async function getTencentOpenReply({ msg, id, userInfo }) {
|
|
|
208
207
|
// 其他协议可以发链接的用H5卡片发送
|
|
209
208
|
const music = resData.msg[0];
|
|
210
209
|
return [
|
|
211
|
-
{
|
|
212
|
-
type: 1,
|
|
213
|
-
content: resData.answer,
|
|
214
|
-
},
|
|
215
|
-
{ type: 4, url: music.music_url, title: music.song_name, thumbnailUrl: music.pic_url, description: music.singer_name },
|
|
210
|
+
{ type: 4, url: music.url, title: music.title, thumbnailUrl: music.picurl, description: music.description },
|
|
216
211
|
];
|
|
217
212
|
}
|
|
218
213
|
}
|
|
@@ -44,7 +44,10 @@ export function avatarCrop({ msg, name, config, avatar }: {
|
|
|
44
44
|
config: any;
|
|
45
45
|
avatar: any;
|
|
46
46
|
}): Promise<any[] | any>;
|
|
47
|
-
export function emptyMsg(
|
|
47
|
+
export function emptyMsg({ room, isMention }: {
|
|
48
|
+
room: any;
|
|
49
|
+
isMention: any;
|
|
50
|
+
}): {
|
|
48
51
|
type: number;
|
|
49
52
|
content: string;
|
|
50
53
|
url: string;
|
|
@@ -10,7 +10,9 @@ const index_js_1 = require("../lib/index.js");
|
|
|
10
10
|
const lanuch_js_1 = require("../puppeteer-paint/lanuch.js");
|
|
11
11
|
const index_js_2 = require("../common/index.js");
|
|
12
12
|
const superagent_js_1 = require("../proxy/superagent.js");
|
|
13
|
-
function emptyMsg() {
|
|
13
|
+
function emptyMsg({ room, isMention }) {
|
|
14
|
+
if (room && !isMention)
|
|
15
|
+
return [];
|
|
14
16
|
let msgArr = []; // 返回的消息列表
|
|
15
17
|
let obj = { type: 1, content: '我在呢', url: '' }; // 消息主体
|
|
16
18
|
msgArr.push(obj);
|
|
@@ -169,9 +169,7 @@ async function getTencentOpenReply({ msg, id, userInfo }) {
|
|
|
169
169
|
const replys = [];
|
|
170
170
|
multiList.forEach((item) => {
|
|
171
171
|
item = item.replace(/<\/?.+?\/?>/g, '');
|
|
172
|
-
console.log('item', item);
|
|
173
172
|
const reply = getFormatReply(item, resData.options || [], userInfo, config.puppetType);
|
|
174
|
-
console.log('reply', reply);
|
|
175
173
|
replys.push(...reply);
|
|
176
174
|
});
|
|
177
175
|
return replys;
|
|
@@ -184,13 +182,14 @@ async function getTencentOpenReply({ msg, id, userInfo }) {
|
|
|
184
182
|
else if (resData.answer_type === 'music') {
|
|
185
183
|
// web 端协议以文字和图片的形式发送
|
|
186
184
|
if (config.puppetType === 'wechaty-puppet-wechat') {
|
|
187
|
-
const
|
|
188
|
-
const
|
|
189
|
-
const
|
|
185
|
+
const res = JSON.parse(resData.answer);
|
|
186
|
+
const music = res.news.articles[0];
|
|
187
|
+
const musicContent = `【歌名】:《${music && music.title}》\n【听歌地址】:${music && music.url}`;
|
|
188
|
+
const musicPic = music && music.picurl;
|
|
190
189
|
return [
|
|
191
190
|
{
|
|
192
191
|
type: 1,
|
|
193
|
-
content:
|
|
192
|
+
content: musicContent,
|
|
194
193
|
},
|
|
195
194
|
{
|
|
196
195
|
type: 2,
|
|
@@ -202,11 +201,7 @@ async function getTencentOpenReply({ msg, id, userInfo }) {
|
|
|
202
201
|
// 其他协议可以发链接的用H5卡片发送
|
|
203
202
|
const music = resData.msg[0];
|
|
204
203
|
return [
|
|
205
|
-
{
|
|
206
|
-
type: 1,
|
|
207
|
-
content: resData.answer,
|
|
208
|
-
},
|
|
209
|
-
{ type: 4, url: music.music_url, title: music.song_name, thumbnailUrl: music.pic_url, description: music.singer_name },
|
|
204
|
+
{ type: 4, url: music.url, title: music.title, thumbnailUrl: music.picurl, description: music.description },
|
|
210
205
|
];
|
|
211
206
|
}
|
|
212
207
|
}
|
|
@@ -44,7 +44,10 @@ export function avatarCrop({ msg, name, config, avatar }: {
|
|
|
44
44
|
config: any;
|
|
45
45
|
avatar: any;
|
|
46
46
|
}): Promise<any[] | any>;
|
|
47
|
-
export function emptyMsg(
|
|
47
|
+
export function emptyMsg({ room, isMention }: {
|
|
48
|
+
room: any;
|
|
49
|
+
isMention: any;
|
|
50
|
+
}): {
|
|
48
51
|
type: number;
|
|
49
52
|
content: string;
|
|
50
53
|
url: string;
|
|
@@ -4,7 +4,9 @@ import { contentDistinguish, setLocalSchedule, isRealDate } from '../lib/index.j
|
|
|
4
4
|
import { generateAvatar } from '../puppeteer-paint/lanuch.js';
|
|
5
5
|
import { addRoom } from '../common/index.js';
|
|
6
6
|
import { service, callbackAibotApi } from '../proxy/superagent.js';
|
|
7
|
-
function emptyMsg() {
|
|
7
|
+
function emptyMsg({ room, isMention }) {
|
|
8
|
+
if (room && !isMention)
|
|
9
|
+
return [];
|
|
8
10
|
let msgArr = []; // 返回的消息列表
|
|
9
11
|
let obj = { type: 1, content: '我在呢', url: '' }; // 消息主体
|
|
10
12
|
msgArr.push(obj);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wechaty-web-panel",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"registry": " https://registry.npmjs.org/",
|
|
75
|
-
"tag": "
|
|
75
|
+
"tag": "latest",
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
78
|
"_id": "wechaty-web-panel@1.0.6",
|