@alemonjs/qq-bot 2.1.3 → 2.1.4
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/format.js +2 -3
- package/lib/sends.js +1 -1
- package/package.json +1 -1
package/lib/format.js
CHANGED
|
@@ -58,8 +58,7 @@ const markdownToText = (items, hideUnsupported) => {
|
|
|
58
58
|
return String(item?.value ?? '');
|
|
59
59
|
}
|
|
60
60
|
})
|
|
61
|
-
.join('')
|
|
62
|
-
.trim();
|
|
61
|
+
.join('');
|
|
63
62
|
};
|
|
64
63
|
const buttonsToText = (rows) => {
|
|
65
64
|
return rows.map((row) => row.value.map((btn) => `[${btn.value}]`).join(' ')).join('\n');
|
|
@@ -84,7 +83,7 @@ const markdownRawToText = (raw, hideUnsupported) => {
|
|
|
84
83
|
text = text.replace(/^[-*_]{3,}\s*$/gm, hideUnsupported ? '' : '————————');
|
|
85
84
|
text = text.replace(/^[\s]*[-*+]\s+/gm, '· ');
|
|
86
85
|
text = text.replace(/^[\s]*(\d+)\.\s+/gm, '$1. ');
|
|
87
|
-
return text
|
|
86
|
+
return text;
|
|
88
87
|
};
|
|
89
88
|
const dataEnumToText = (item, hideUnsupported) => {
|
|
90
89
|
if (Number(hideUnsupported) >= 4)
|
package/lib/sends.js
CHANGED
|
@@ -326,7 +326,7 @@ const flattenMdToText = (content, val) => {
|
|
|
326
326
|
parts.push(buttonsToText(item.value));
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
return parts.filter(Boolean).join('\n');
|
|
329
|
+
return parts.filter(Boolean).join('\n').replace(/^[^\S\n\r]+|[^\S\n\r]+$/g, '');
|
|
330
330
|
};
|
|
331
331
|
const sendOpenApiMessage = async (content, val, baseParams, uploadMedia, sendMessage, label) => {
|
|
332
332
|
const config = getQQBotConfig();
|