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.
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
6
6
  */
7
7
  exports.packageJson = {
8
8
  "name": "wechaty-web-panel",
9
- "version": "1.1.21",
9
+ "version": "1.2.1",
10
10
  "description": "",
11
11
  "exports": {
12
12
  ".": {
@@ -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 music = resData.msg[0];
194
- const musicContent = `【歌名】:《${music && music.song_name}》\n【歌手】:${music && music.singer_name}\n【听歌地址】:${music && music.music_url}`;
195
- const musicPic = music && music.pic_url;
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: resData.answer + '\n\n' + musicContent,
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);
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const packageJson = {
5
5
  "name": "wechaty-web-panel",
6
- "version": "1.1.21",
6
+ "version": "1.2.1",
7
7
  "description": "",
8
8
  "exports": {
9
9
  ".": {
@@ -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 music = resData.msg[0];
188
- const musicContent = `【歌名】:《${music && music.song_name}》\n【歌手】:${music && music.singer_name}\n【听歌地址】:${music && music.music_url}`;
189
- const musicPic = music && music.pic_url;
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: resData.answer + '\n\n' + musicContent,
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.21",
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": "next",
75
+ "tag": "latest",
76
76
  "access": "public"
77
77
  },
78
78
  "_id": "wechaty-web-panel@1.0.6",