utilitas 1995.2.52 → 1995.2.53

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/bot.mjs CHANGED
@@ -270,7 +270,7 @@ const editMessageText = async (ctx, md, lastMsgId, text, extra) => {
270
270
  };
271
271
 
272
272
  const memorize = async (ctx) => {
273
- if (ctx.skipMemorize) { return; }
273
+ if (ctx._skipMemorize) { return; }
274
274
  const received = ctx.update;
275
275
  const received_text = ctx.text;
276
276
  const id = received.update_id;
@@ -320,6 +320,7 @@ const subconscious = [{
320
320
  ctx.collect = (content, type) => type ? ctx.collected.push(
321
321
  { type, content }
322
322
  ) : (ctx.text = content);
323
+ ctx.skipMemorize = () => ctx._skipMemorize = true;
323
324
  ctx.ok = async (message, options) => {
324
325
  let pages = paging(message);
325
326
  pages = !pages.length && options?.onProgress ? [''] : pages;
@@ -438,13 +439,13 @@ const subconscious = [{
438
439
  },
439
440
  }, {
440
441
  run: true, priority: -8940, name: 'laws', func: async (ctx, next) => {
441
- ctx.skipMemorize = true;
442
442
  const qsts = [...questions, {
443
443
  q: ['/echo'],
444
444
  a: json({ update: ctx.update, session: ctx.session }),
445
445
  }];
446
446
  for (let s of qsts) {
447
447
  if (insensitiveCompare(s.q, ctx.text)) {
448
+ ctx.skipMemorize();
448
449
  return await ctx.ok(s.a, { md: true });
449
450
  }
450
451
  }
@@ -634,7 +635,7 @@ const subconscious = [{
634
635
  },
635
636
  }, {
636
637
  run: true, priority: -8850, name: 'help', func: async (ctx, next) => {
637
- ctx.skipMemorize = true;
638
+ ctx.skipMemorize();
638
639
  const help = ctx._.info ? [ctx._.info] : [];
639
640
  for (let i in ctx._.skills) {
640
641
  const _help = [];
@@ -674,7 +675,7 @@ const subconscious = [{
674
675
  },
675
676
  }, {
676
677
  run: true, priority: -8840, name: 'configuration', func: async (ctx, next) => {
677
- ctx.skipMemorize = true;
678
+ ctx.skipMemorize();
678
679
  switch (ctx.cmd.cmd) {
679
680
  case 'set':
680
681
  try {
@@ -688,7 +689,7 @@ const subconscious = [{
688
689
  Object.keys(ctx.config).map(x => _config[x] += ' <-- SET');
689
690
  await ctx.map(_config);
690
691
  } catch (err) {
691
- await ctx.ok(err.message || err);
692
+ await ctx.er(err.message || err);
692
693
  }
693
694
  break;
694
695
  case 'reset':
@@ -718,8 +719,8 @@ const subconscious = [{
718
719
  },
719
720
  }, {
720
721
  run: true, priority: -8830, name: 'lorem-ipsum', func: async (ctx, next) => {
721
- ctx.skipMemorize = true;
722
722
  if (ctx.cmd?.cmd !== 'lorem') { return await next(); }
723
+ ctx.skipMemorize();
723
724
  const lib = await ignoreErrFunc(async () => await need('lorem-ipsum'));
724
725
  if (!lib) { return await ctx.er('`lorem-ipsum` not found.'); }
725
726
  const lorem = new lib.LoremIpsum();
@@ -749,7 +750,7 @@ const subconscious = [{
749
750
  }
750
751
  }, {
751
752
  run: true, priority: -8820, name: 'history', func: async (ctx, next) => {
752
- ctx.skipMemorize = true;
753
+ ctx.skipMemorize();
753
754
  const regex = '[-—]+skip=[0-9]*';
754
755
  let result;
755
756
  print(ctx.cmd.args);
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1995.2.52",
4
+ "version": "1995.2.53",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1995.2.52",
4
+ "version": "1995.2.53",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",