wechaty-web-panel 1.6.15 → 1.6.16
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/CHANGELOG.md +6 -0
- package/dist/cjs/src/botInstance/dify.js +2 -2
- package/dist/cjs/src/botInstance/officialOpenAi.js +2 -2
- package/dist/cjs/src/botInstance/unOfficialOpenAi.js +2 -2
- package/dist/cjs/src/common/index.js +19 -6
- package/dist/cjs/src/const/puppet-type.d.ts +5 -0
- package/dist/cjs/src/const/puppet-type.js +13 -1
- package/dist/cjs/src/handlers/on-message.js +2 -2
- package/dist/cjs/src/lib/index.d.ts +1 -0
- package/dist/cjs/src/lib/index.js +5 -1
- package/dist/cjs/src/package-json.js +1 -1
- package/dist/cjs/src/task/rss.js +2 -2
- package/dist/esm/src/botInstance/dify.js +2 -2
- package/dist/esm/src/botInstance/officialOpenAi.js +2 -2
- package/dist/esm/src/botInstance/unOfficialOpenAi.js +2 -2
- package/dist/esm/src/common/index.js +20 -7
- package/dist/esm/src/const/puppet-type.d.ts +5 -0
- package/dist/esm/src/const/puppet-type.js +11 -0
- package/dist/esm/src/handlers/on-message.js +2 -2
- package/dist/esm/src/lib/index.d.ts +1 -0
- package/dist/esm/src/lib/index.js +3 -0
- package/dist/esm/src/package-json.js +1 -1
- package/dist/esm/src/task/rss.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -67,8 +67,8 @@ class DifyAi {
|
|
|
67
67
|
return [{ type: 1, content: '这个话题不适合讨论,换个话题吧。' }];
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
if (systemMessage) {
|
|
71
|
-
console.log('
|
|
70
|
+
if (systemMessage || content === 'reset' || content === '重置') {
|
|
71
|
+
console.log('重新更新上下文对话');
|
|
72
72
|
this.chatOption[uid] = {};
|
|
73
73
|
}
|
|
74
74
|
console.log('this.chatOption[uid]', this.chatOption[uid]);
|
|
@@ -125,8 +125,8 @@ class OfficialOpenAi {
|
|
|
125
125
|
return [{ type: 1, content: '这个话题不适合讨论,换个话题吧。' }];
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
if (systemMessage) {
|
|
129
|
-
console.log('
|
|
128
|
+
if (systemMessage || content === 'reset' || content === '重置') {
|
|
129
|
+
console.log('重新更新上下文对话');
|
|
130
130
|
this.chatOption[uid] = {};
|
|
131
131
|
}
|
|
132
132
|
const { conversationId, text, id } = systemMessage ? await this.chatGPT.sendMessage(content, { ...this.chatOption[uid], systemMessage, timeoutMs: this.config.timeoutMs * 1000 || 80 * 1000 }) : await this.chatGPT.sendMessage(content, { ...this.chatOption[uid], timeoutMs: this.config.timeoutMs * 1000 || 80 * 1000 });
|
|
@@ -83,9 +83,9 @@ class UnOfficialOpenAi {
|
|
|
83
83
|
await this.init();
|
|
84
84
|
}
|
|
85
85
|
let question = this.config.systemMessage ? this.config.systemMessage + content : content;
|
|
86
|
-
if (systemMessage) {
|
|
86
|
+
if (systemMessage || content === 'reset' || content === '重置') {
|
|
87
87
|
question = systemMessage + content;
|
|
88
|
-
console.log('
|
|
88
|
+
console.log('重新更新上下文对话');
|
|
89
89
|
this.chatOption[uid] = {};
|
|
90
90
|
}
|
|
91
91
|
const { conversationId, text, id } = systemMessage ? await this.chatGPT.sendMessage(question, { ...this.chatOption[uid], systemMessage, timeoutMs: this.config.timeoutMs * 1000 || 80 * 1000 }) : await this.chatGPT.sendMessage(question, { ...this.chatOption[uid], timeoutMs: this.config.timeoutMs * 1000 || 80 * 1000 });
|
|
@@ -8,6 +8,13 @@ const index_js_1 = require("../lib/index.js");
|
|
|
8
8
|
const file_box_1 = require("file-box");
|
|
9
9
|
const configDb_js_1 = require("../db/configDb.js");
|
|
10
10
|
const puppet_type_js_1 = require("../const/puppet-type.js");
|
|
11
|
+
async function formatContent(text) {
|
|
12
|
+
const isWin = (0, puppet_type_js_1.isWindowsPlatform)();
|
|
13
|
+
if (isWin) {
|
|
14
|
+
return text.replace(/\n/g, "\r");
|
|
15
|
+
}
|
|
16
|
+
return text;
|
|
17
|
+
}
|
|
11
18
|
/**
|
|
12
19
|
* 获取每日新闻内容
|
|
13
20
|
* @param {*} sortId 新闻资讯分类Id
|
|
@@ -202,8 +209,9 @@ async function roomSay(room, contact, msg) {
|
|
|
202
209
|
console.log('回复内容:', JSON.stringify(msg));
|
|
203
210
|
try {
|
|
204
211
|
if (msg.type === 1 && msg.content) {
|
|
212
|
+
const content = await formatContent(msg.content);
|
|
205
213
|
// 文字
|
|
206
|
-
contact ? await room.say(
|
|
214
|
+
contact ? await room.say(content, contact) : await room.say(content);
|
|
207
215
|
}
|
|
208
216
|
else if (msg.type === 2 && msg.url) {
|
|
209
217
|
// url文件
|
|
@@ -220,9 +228,11 @@ async function roomSay(room, contact, msg) {
|
|
|
220
228
|
await room.say(obj);
|
|
221
229
|
}
|
|
222
230
|
else if (msg.type === 4 && msg.url && msg.title && msg.description) {
|
|
231
|
+
const description = await formatContent(msg.description);
|
|
232
|
+
const title = await formatContent(msg.title);
|
|
223
233
|
let url = new this.UrlLink({
|
|
224
|
-
description:
|
|
225
|
-
thumbnailUrl:
|
|
234
|
+
description: description,
|
|
235
|
+
thumbnailUrl: title,
|
|
226
236
|
title: msg.title,
|
|
227
237
|
url: msg.url,
|
|
228
238
|
});
|
|
@@ -265,8 +275,9 @@ async function contactSay(contact, msg, isRoom = false) {
|
|
|
265
275
|
console.log('回复内容:', JSON.stringify(msg));
|
|
266
276
|
try {
|
|
267
277
|
if (msg.type === 1 && msg.content) {
|
|
278
|
+
const content = await formatContent(msg.content);
|
|
268
279
|
// 文字
|
|
269
|
-
await contact.say(
|
|
280
|
+
await contact.say(content);
|
|
270
281
|
}
|
|
271
282
|
else if (msg.type === 2 && msg.url) {
|
|
272
283
|
// url文件
|
|
@@ -280,10 +291,12 @@ async function contactSay(contact, msg, isRoom = false) {
|
|
|
280
291
|
await contact.say(obj);
|
|
281
292
|
}
|
|
282
293
|
else if (msg.type === 4 && msg.url && msg.title && msg.description) {
|
|
294
|
+
const description = await formatContent(msg.description);
|
|
295
|
+
const title = await formatContent(msg.title);
|
|
283
296
|
let url = new this.UrlLink({
|
|
284
|
-
description:
|
|
297
|
+
description: description,
|
|
285
298
|
thumbnailUrl: msg.thumbUrl,
|
|
286
|
-
title:
|
|
299
|
+
title: title,
|
|
287
300
|
url: msg.url,
|
|
288
301
|
});
|
|
289
302
|
await contact.say(url);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNotWebPuppet = exports.getPuppetEol = exports.SEND_APP_MSG_PUPPET = exports.WRAP_REPLACE_PUPPET = exports.PUPPET_MAP = void 0;
|
|
3
|
+
exports.isNotWebPuppet = exports.isWindowsPlatform = exports.getPuppetEol = exports.SEND_APP_MSG_PUPPET = exports.WRAP_REPLACE_PUPPET = exports.PUPPET_MAP = void 0;
|
|
4
4
|
const puppetDb_js_1 = require("../db/puppetDb.js");
|
|
5
5
|
exports.PUPPET_MAP = {
|
|
6
6
|
// https://github.com/wechaty/puppet-wechat4u
|
|
@@ -52,6 +52,18 @@ async function getPuppetEol() {
|
|
|
52
52
|
return '\n';
|
|
53
53
|
}
|
|
54
54
|
exports.getPuppetEol = getPuppetEol;
|
|
55
|
+
/**
|
|
56
|
+
* 判断是不是windows平台
|
|
57
|
+
* @return {Promise<boolean>}
|
|
58
|
+
*/
|
|
59
|
+
async function isWindowsPlatform() {
|
|
60
|
+
const puppetInfo = await (0, puppetDb_js_1.getPuppetInfo)();
|
|
61
|
+
if (puppetInfo.puppetType === 'PuppetXp' || puppetInfo.puppetType === 'PuppetEngine') {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
exports.isWindowsPlatform = isWindowsPlatform;
|
|
55
67
|
/**
|
|
56
68
|
* 判断是否是web 协议
|
|
57
69
|
* @return {Promise<boolean>}
|
|
@@ -85,7 +85,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
|
|
|
85
85
|
console.log(`发消息人${await contact.name()}:发了一个小程序`);
|
|
86
86
|
const miniProgram = await msg.toMiniProgram();
|
|
87
87
|
if (config.parseMini && miniProgram.payload) {
|
|
88
|
-
const miniParse = `【小程序解析】${eol}${eol}appid:${miniProgram.appid()}${eol}username:${miniProgram.username()}${eol}标题:${miniProgram.title()}${eol}描述:${miniProgram.description()}${eol}路径:${miniProgram.pagePath()}`;
|
|
88
|
+
const miniParse = `【小程序解析】${eol}${eol}appid:${miniProgram.appid()}${eol}username:${miniProgram.username().replace('@app', '')}${eol}标题:${miniProgram.title()}${eol}描述:${miniProgram.description()}${eol}路径:${decodeURIComponent(miniProgram.pagePath())}`;
|
|
89
89
|
contact.say(miniParse);
|
|
90
90
|
}
|
|
91
91
|
console.log('mini', miniProgram);
|
|
@@ -190,7 +190,7 @@ async function dispatchRoomFilterByMsgType(that, room, msg) {
|
|
|
190
190
|
console.log(`群名: ${roomName} 发消息人: ${contactName} 发了一个小程序`);
|
|
191
191
|
const miniProgram = await msg.toMiniProgram();
|
|
192
192
|
if (config.parseMiniRooms.includes(roomName) && miniProgram.payload) {
|
|
193
|
-
const miniParse = `【小程序解析】${eol}${eol}appid:${miniProgram.appid()}${eol}username:${miniProgram.username()}${eol}标题:${miniProgram.title()}${eol}描述:${miniProgram.description()}${eol}路径:${miniProgram.pagePath()}${eol}`;
|
|
193
|
+
const miniParse = `【小程序解析】${eol}${eol}appid:${miniProgram.appid()}${eol}username:${miniProgram.username().replace('@app', '')}${eol}标题:${miniProgram.title()}${eol}描述:${miniProgram.description()}${eol}路径:${decodeURIComponent(miniProgram.pagePath())}${eol}`;
|
|
194
194
|
room.say(miniParse);
|
|
195
195
|
}
|
|
196
196
|
console.log('mini', miniProgram);
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getNewsType = exports.groupArray = exports.cancelAllSchedule = exports.throttle = exports.msgArr = exports.contentDistinguish = exports.getFormatQuery = exports.MD5 = exports.writeFile = exports.randomRange = exports.getConstellation = exports.isRealDate = exports.formatDate = exports.getDay = exports.convertTime = exports.getToday = exports.delay = exports.parseBody = exports.setLocalSchedule = exports.Base64Decode = exports.Base64Encode = void 0;
|
|
29
|
+
exports.getNewsType = exports.groupArray = exports.cancelAllSchedule = exports.throttle = exports.msgArr = exports.contentDistinguish = exports.getFormatQuery = exports.MD5 = exports.writeFile = exports.randomRange = exports.getConstellation = exports.isRealDate = exports.formatDate = exports.getDay = exports.convertTime = exports.getToday = exports.delay = exports.parseBody = exports.setLocalSchedule = exports.Base64Decode = exports.Base64Encode = exports.delHtmlTag = void 0;
|
|
30
30
|
const crypto_1 = __importDefault(require("crypto"));
|
|
31
31
|
const schedule = __importStar(require("node-schedule"));
|
|
32
32
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -492,6 +492,10 @@ function groupArray(array, subGroupLength) {
|
|
|
492
492
|
return newArray;
|
|
493
493
|
}
|
|
494
494
|
exports.groupArray = groupArray;
|
|
495
|
+
function delHtmlTag(str) {
|
|
496
|
+
return str.replace(/<[^>]+>/g, ""); //去掉所有的html标记
|
|
497
|
+
}
|
|
498
|
+
exports.delHtmlTag = delHtmlTag;
|
|
495
499
|
exports.default = {
|
|
496
500
|
Base64Encode,
|
|
497
501
|
Base64Decode,
|
package/dist/cjs/src/task/rss.js
CHANGED
|
@@ -45,11 +45,11 @@ async function getRssContent(info) {
|
|
|
45
45
|
async function setContent(feed, info) {
|
|
46
46
|
const eol = await (0, puppet_type_js_1.getPuppetEol)();
|
|
47
47
|
if (info.showLink) {
|
|
48
|
-
const res = { type: 4, url: feed.link, title: feed.title, description: feed.content.substring(0,
|
|
48
|
+
const res = { type: 4, url: feed.link, title: (0, index_js_1.delHtmlTag)(feed.title), description: (0, index_js_1.delHtmlTag)(feed.content.substring(0, 80)), thumbUrl: info.thumbUrl };
|
|
49
49
|
return [res];
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
const content = `${info.prefixWord ? info.prefixWord + eol + eol : ''}《${feed.title}》${eol}【原链接】:${feed.link}${eol}【摘要】:${feed.content.substring(0,
|
|
52
|
+
const content = `${info.prefixWord ? info.prefixWord + eol + eol : ''}《${(0, index_js_1.delHtmlTag)(feed.title)}》${eol}【原链接】:${feed.link}${eol}【摘要】:${(0, index_js_1.delHtmlTag)(feed.content.substring(0, 300))}...${eol}${eol}${info.suffixWord || ''}`;
|
|
53
53
|
return [{ type: 1, content: content }];
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -62,8 +62,8 @@ class DifyAi {
|
|
|
62
62
|
return [{ type: 1, content: '这个话题不适合讨论,换个话题吧。' }];
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
if (systemMessage) {
|
|
66
|
-
console.log('
|
|
65
|
+
if (systemMessage || content === 'reset' || content === '重置') {
|
|
66
|
+
console.log('重新更新上下文对话');
|
|
67
67
|
this.chatOption[uid] = {};
|
|
68
68
|
}
|
|
69
69
|
console.log('this.chatOption[uid]', this.chatOption[uid]);
|
|
@@ -120,8 +120,8 @@ class OfficialOpenAi {
|
|
|
120
120
|
return [{ type: 1, content: '这个话题不适合讨论,换个话题吧。' }];
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
if (systemMessage) {
|
|
124
|
-
console.log('
|
|
123
|
+
if (systemMessage || content === 'reset' || content === '重置') {
|
|
124
|
+
console.log('重新更新上下文对话');
|
|
125
125
|
this.chatOption[uid] = {};
|
|
126
126
|
}
|
|
127
127
|
const { conversationId, text, id } = systemMessage ? await this.chatGPT.sendMessage(content, { ...this.chatOption[uid], systemMessage, timeoutMs: this.config.timeoutMs * 1000 || 80 * 1000 }) : await this.chatGPT.sendMessage(content, { ...this.chatOption[uid], timeoutMs: this.config.timeoutMs * 1000 || 80 * 1000 });
|
|
@@ -78,9 +78,9 @@ class UnOfficialOpenAi {
|
|
|
78
78
|
await this.init();
|
|
79
79
|
}
|
|
80
80
|
let question = this.config.systemMessage ? this.config.systemMessage + content : content;
|
|
81
|
-
if (systemMessage) {
|
|
81
|
+
if (systemMessage || content === 'reset' || content === '重置') {
|
|
82
82
|
question = systemMessage + content;
|
|
83
|
-
console.log('
|
|
83
|
+
console.log('重新更新上下文对话');
|
|
84
84
|
this.chatOption[uid] = {};
|
|
85
85
|
}
|
|
86
86
|
const { conversationId, text, id } = systemMessage ? await this.chatGPT.sendMessage(question, { ...this.chatOption[uid], systemMessage, timeoutMs: this.config.timeoutMs * 1000 || 80 * 1000 }) : await this.chatGPT.sendMessage(question, { ...this.chatOption[uid], timeoutMs: this.config.timeoutMs * 1000 || 80 * 1000 });
|
|
@@ -4,7 +4,14 @@ import { getUser } from '../db/userDb.js';
|
|
|
4
4
|
import { formatDate, getDay, groupArray, delay } from '../lib/index.js';
|
|
5
5
|
import { FileBox } from 'file-box';
|
|
6
6
|
import { allConfig } from '../db/configDb.js';
|
|
7
|
-
import { getPuppetEol } from "../const/puppet-type.js";
|
|
7
|
+
import { getPuppetEol, isWindowsPlatform } from "../const/puppet-type.js";
|
|
8
|
+
async function formatContent(text) {
|
|
9
|
+
const isWin = isWindowsPlatform();
|
|
10
|
+
if (isWin) {
|
|
11
|
+
return text.replace(/\n/g, "\r");
|
|
12
|
+
}
|
|
13
|
+
return text;
|
|
14
|
+
}
|
|
8
15
|
/**
|
|
9
16
|
* 获取每日新闻内容
|
|
10
17
|
* @param {*} sortId 新闻资讯分类Id
|
|
@@ -192,8 +199,9 @@ async function roomSay(room, contact, msg) {
|
|
|
192
199
|
console.log('回复内容:', JSON.stringify(msg));
|
|
193
200
|
try {
|
|
194
201
|
if (msg.type === 1 && msg.content) {
|
|
202
|
+
const content = await formatContent(msg.content);
|
|
195
203
|
// 文字
|
|
196
|
-
contact ? await room.say(
|
|
204
|
+
contact ? await room.say(content, contact) : await room.say(content);
|
|
197
205
|
}
|
|
198
206
|
else if (msg.type === 2 && msg.url) {
|
|
199
207
|
// url文件
|
|
@@ -210,9 +218,11 @@ async function roomSay(room, contact, msg) {
|
|
|
210
218
|
await room.say(obj);
|
|
211
219
|
}
|
|
212
220
|
else if (msg.type === 4 && msg.url && msg.title && msg.description) {
|
|
221
|
+
const description = await formatContent(msg.description);
|
|
222
|
+
const title = await formatContent(msg.title);
|
|
213
223
|
let url = new this.UrlLink({
|
|
214
|
-
description:
|
|
215
|
-
thumbnailUrl:
|
|
224
|
+
description: description,
|
|
225
|
+
thumbnailUrl: title,
|
|
216
226
|
title: msg.title,
|
|
217
227
|
url: msg.url,
|
|
218
228
|
});
|
|
@@ -254,8 +264,9 @@ async function contactSay(contact, msg, isRoom = false) {
|
|
|
254
264
|
console.log('回复内容:', JSON.stringify(msg));
|
|
255
265
|
try {
|
|
256
266
|
if (msg.type === 1 && msg.content) {
|
|
267
|
+
const content = await formatContent(msg.content);
|
|
257
268
|
// 文字
|
|
258
|
-
await contact.say(
|
|
269
|
+
await contact.say(content);
|
|
259
270
|
}
|
|
260
271
|
else if (msg.type === 2 && msg.url) {
|
|
261
272
|
// url文件
|
|
@@ -269,10 +280,12 @@ async function contactSay(contact, msg, isRoom = false) {
|
|
|
269
280
|
await contact.say(obj);
|
|
270
281
|
}
|
|
271
282
|
else if (msg.type === 4 && msg.url && msg.title && msg.description) {
|
|
283
|
+
const description = await formatContent(msg.description);
|
|
284
|
+
const title = await formatContent(msg.title);
|
|
272
285
|
let url = new this.UrlLink({
|
|
273
|
-
description:
|
|
286
|
+
description: description,
|
|
274
287
|
thumbnailUrl: msg.thumbUrl,
|
|
275
|
-
title:
|
|
288
|
+
title: title,
|
|
276
289
|
url: msg.url,
|
|
277
290
|
});
|
|
278
291
|
await contact.say(url);
|
|
@@ -48,6 +48,17 @@ export async function getPuppetEol() {
|
|
|
48
48
|
}
|
|
49
49
|
return '\n';
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* 判断是不是windows平台
|
|
53
|
+
* @return {Promise<boolean>}
|
|
54
|
+
*/
|
|
55
|
+
export async function isWindowsPlatform() {
|
|
56
|
+
const puppetInfo = await getPuppetInfo();
|
|
57
|
+
if (puppetInfo.puppetType === 'PuppetXp' || puppetInfo.puppetType === 'PuppetEngine') {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
51
62
|
/**
|
|
52
63
|
* 判断是否是web 协议
|
|
53
64
|
* @return {Promise<boolean>}
|
|
@@ -83,7 +83,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
|
|
|
83
83
|
console.log(`发消息人${await contact.name()}:发了一个小程序`);
|
|
84
84
|
const miniProgram = await msg.toMiniProgram();
|
|
85
85
|
if (config.parseMini && miniProgram.payload) {
|
|
86
|
-
const miniParse = `【小程序解析】${eol}${eol}appid:${miniProgram.appid()}${eol}username:${miniProgram.username()}${eol}标题:${miniProgram.title()}${eol}描述:${miniProgram.description()}${eol}路径:${miniProgram.pagePath()}`;
|
|
86
|
+
const miniParse = `【小程序解析】${eol}${eol}appid:${miniProgram.appid()}${eol}username:${miniProgram.username().replace('@app', '')}${eol}标题:${miniProgram.title()}${eol}描述:${miniProgram.description()}${eol}路径:${decodeURIComponent(miniProgram.pagePath())}`;
|
|
87
87
|
contact.say(miniParse);
|
|
88
88
|
}
|
|
89
89
|
console.log('mini', miniProgram);
|
|
@@ -188,7 +188,7 @@ async function dispatchRoomFilterByMsgType(that, room, msg) {
|
|
|
188
188
|
console.log(`群名: ${roomName} 发消息人: ${contactName} 发了一个小程序`);
|
|
189
189
|
const miniProgram = await msg.toMiniProgram();
|
|
190
190
|
if (config.parseMiniRooms.includes(roomName) && miniProgram.payload) {
|
|
191
|
-
const miniParse = `【小程序解析】${eol}${eol}appid:${miniProgram.appid()}${eol}username:${miniProgram.username()}${eol}标题:${miniProgram.title()}${eol}描述:${miniProgram.description()}${eol}路径:${miniProgram.pagePath()}${eol}`;
|
|
191
|
+
const miniParse = `【小程序解析】${eol}${eol}appid:${miniProgram.appid()}${eol}username:${miniProgram.username().replace('@app', '')}${eol}标题:${miniProgram.title()}${eol}描述:${miniProgram.description()}${eol}路径:${decodeURIComponent(miniProgram.pagePath())}${eol}`;
|
|
192
192
|
room.say(miniParse);
|
|
193
193
|
}
|
|
194
194
|
console.log('mini', miniProgram);
|
|
@@ -442,6 +442,9 @@ function groupArray(array, subGroupLength) {
|
|
|
442
442
|
}
|
|
443
443
|
return newArray;
|
|
444
444
|
}
|
|
445
|
+
export function delHtmlTag(str) {
|
|
446
|
+
return str.replace(/<[^>]+>/g, ""); //去掉所有的html标记
|
|
447
|
+
}
|
|
445
448
|
export { Base64Encode };
|
|
446
449
|
export { Base64Decode };
|
|
447
450
|
export { setLocalSchedule };
|
package/dist/esm/src/task/rss.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setLocalSchedule, delay, cancelAllSchedule } from "../lib/index.js";
|
|
1
|
+
import { setLocalSchedule, delay, cancelAllSchedule, delHtmlTag } from "../lib/index.js";
|
|
2
2
|
import { getAllRssConfig } from '../db/rssConfig.js';
|
|
3
3
|
import { addRssHistory, updateRssHistory, getRssHistoryById } from "../db/rssHistory.js";
|
|
4
4
|
import { roomSay, contactSay } from "../common/index.js";
|
|
@@ -39,11 +39,11 @@ async function getRssContent(info) {
|
|
|
39
39
|
async function setContent(feed, info) {
|
|
40
40
|
const eol = await getPuppetEol();
|
|
41
41
|
if (info.showLink) {
|
|
42
|
-
const res = { type: 4, url: feed.link, title: feed.title, description: feed.content.substring(0,
|
|
42
|
+
const res = { type: 4, url: feed.link, title: delHtmlTag(feed.title), description: delHtmlTag(feed.content.substring(0, 80)), thumbUrl: info.thumbUrl };
|
|
43
43
|
return [res];
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
|
-
const content = `${info.prefixWord ? info.prefixWord + eol + eol : ''}《${feed.title}》${eol}【原链接】:${feed.link}${eol}【摘要】:${feed.content.substring(0,
|
|
46
|
+
const content = `${info.prefixWord ? info.prefixWord + eol + eol : ''}《${delHtmlTag(feed.title)}》${eol}【原链接】:${feed.link}${eol}【摘要】:${delHtmlTag(feed.content.substring(0, 300))}...${eol}${eol}${info.suffixWord || ''}`;
|
|
47
47
|
return [{ type: 1, content: content }];
|
|
48
48
|
}
|
|
49
49
|
}
|