utilitas 1999.1.4 → 1999.1.5
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/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/bot.mjs +9 -7
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
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
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
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