utilitas 1999.1.4 → 1999.1.6

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/alan.mjs CHANGED
@@ -1505,7 +1505,7 @@ const analyzeSessions = async (sessionIds, options) => {
1505
1505
  }
1506
1506
  }, await getMaxChatPromptLimit(options));
1507
1507
  const aiResp = Object.keys(sses) ? (await prompt(getInput(), {
1508
- jsonMode: true, simple: true, select: { json: true, fase: true },
1508
+ jsonMode: true, simple: true, select: { json: true, fast: true },
1509
1509
  ...options || {}
1510
1510
  })) : {};
1511
1511
  assert(aiResp, 'Unable to analyze sessions.');
package/lib/bot.mjs CHANGED
@@ -887,14 +887,14 @@ const subconscious = [{
887
887
  switch (ctx.cmd.cmd) {
888
888
  case 'toggle':
889
889
  parsed = {};
890
- Object.keys(parseArgs(ctx.cmd.args)).map(x =>
890
+ Object.keys(await parseArgs(ctx.cmd.args)).map(x =>
891
891
  parsed[x] = !ctx.session.config[x]);
892
892
  case 'set':
893
893
  try {
894
894
  const _config = {
895
895
  ...ctx.session.config = {
896
896
  ...ctx.session.config,
897
- ...ctx.config = parsed || parseArgs(ctx.cmd.args),
897
+ ...ctx.config = parsed || await parseArgs(ctx.cmd.args),
898
898
  }
899
899
  };
900
900
  assert(countKeys(ctx.config), 'No option matched.');
@@ -1039,15 +1039,17 @@ const establish = (bot, module, options) => {
1039
1039
  } : module.func);
1040
1040
  };
1041
1041
 
1042
- const parseArgs = args => {
1042
+ const parseArgs = async args => {
1043
1043
  const { values, tokens } = _parseArgs({
1044
1044
  args: splitArgs((args || '').replaceAll('—', '--')),
1045
1045
  options: bot._.args, tokens: true
1046
1046
  });
1047
1047
  const result = {};
1048
- tokens.map(x => result[x.name] = bot._.args[x.name]?.validate
1049
- ? bot._.args[x.name].validate(values[x.name])
1050
- : values[x.name]);
1048
+ for (let x of tokens) {
1049
+ result[x.name] = bot._.args[x.name]?.validate
1050
+ ? await bot._.args[x.name].validate(values[x.name])
1051
+ : values[x.name];
1052
+ }
1051
1053
  return result;
1052
1054
  };
1053
1055
 
@@ -1124,7 +1126,7 @@ const init = async (options) => {
1124
1126
  module => establish(bot, module, options)
1125
1127
  );
1126
1128
  assert(mods.length, 'Invalid skill set.', 501);
1127
- parseArgs(); // Validate args options.
1129
+ await parseArgs(); // Validate args options.
1128
1130
  bot.catch(console.error);
1129
1131
  bot.launch();
1130
1132
  on(BOT_SEND, data => send(...data || []));
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": "1999.1.4",
4
+ "version": "1999.1.6",
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": "1999.1.4",
4
+ "version": "1999.1.6",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",