utilitas 1999.1.49 → 1999.1.51
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 +3 -16
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +1 -0
- package/lib/bot.mjs +13 -1097
- package/lib/manifest.mjs +1 -1
- package/lib/tape.mjs +4 -4
- package/package.json +1 -1
package/lib/manifest.mjs
CHANGED
package/lib/tape.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
renderCode,
|
|
5
5
|
} from './utilitas.mjs';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { MESSAGE_LENGTH_LIMIT, sendMd } from './bot.mjs';
|
|
8
8
|
import { isPrimary, on, report } from './callosum.mjs';
|
|
9
9
|
import { default as color } from './color.mjs';
|
|
10
10
|
import { end as _end, loop } from './event.mjs';
|
|
@@ -16,11 +16,11 @@ const [defBufCycle, maxBufCycle] = [10, 100];
|
|
|
16
16
|
const stdout = message => process.stdout.write(`${message}\n`);
|
|
17
17
|
const log = (cnt, opt) => _log(cnt, import.meta.url, { time: 1, ...opt || {} });
|
|
18
18
|
const getSndSize = arr => getSendTxt(arr).length;
|
|
19
|
-
const getBufSize = () =>
|
|
19
|
+
const getBufSize = () => MESSAGE_LENGTH_LIMIT * bufferCycle;
|
|
20
20
|
const nextEvent = () => botBuffer?.[0];
|
|
21
21
|
const stringify = any => ensureString(any, trace);
|
|
22
22
|
const packLine = text => `\`\`\`Log\n${(text || '').replaceAll('```', '\\`\\`\\`')}\n\`\`\``;
|
|
23
|
-
const AVAILABLE_LENGTH =
|
|
23
|
+
const AVAILABLE_LENGTH = MESSAGE_LENGTH_LIMIT - (packLine('') + '000 | ').length;
|
|
24
24
|
|
|
25
25
|
let botBuffer, bufferCycle, chatIds, extLog, tarLevel;
|
|
26
26
|
|
|
@@ -64,7 +64,7 @@ const removeChatId = (id) =>
|
|
|
64
64
|
const sync = async () => {
|
|
65
65
|
let [f, n] = [[], ''];
|
|
66
66
|
while (((n = nextEvent())?.[1] || '').length
|
|
67
|
-
&& getSndSize([...f, n]) <=
|
|
67
|
+
&& getSndSize([...f, n]) <= MESSAGE_LENGTH_LIMIT) {
|
|
68
68
|
f.push(botBuffer.shift())
|
|
69
69
|
}
|
|
70
70
|
if (!(f = getSendTxt(f)).length) { return; };
|