bakit 2.0.0-alpha.10 → 2.0.0-alpha.11
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/index.d.ts +5 -0
- package/dist/index.js +10 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -399,6 +399,11 @@ declare const Params: {
|
|
|
399
399
|
maxValue?: number | undefined;
|
|
400
400
|
minValue?: number | undefined;
|
|
401
401
|
}) => NumberParam<Required>;
|
|
402
|
+
readonly user: <Required extends boolean = true>(options: string | {
|
|
403
|
+
name: string;
|
|
404
|
+
description?: string | undefined;
|
|
405
|
+
required?: boolean | undefined;
|
|
406
|
+
}) => UserParam<Required>;
|
|
402
407
|
};
|
|
403
408
|
|
|
404
409
|
declare class BakitError extends Error {
|
package/dist/index.js
CHANGED
|
@@ -397,16 +397,17 @@ var BaseParam = class {
|
|
|
397
397
|
return this.setOption("required", value);
|
|
398
398
|
}
|
|
399
399
|
async resolve(context, value) {
|
|
400
|
-
let { required, name } = this.options;
|
|
401
|
-
if (value === void 0) {
|
|
402
|
-
if (required)
|
|
403
|
-
throw new ArgumentError(name, "is required");
|
|
404
|
-
return null;
|
|
405
|
-
}
|
|
406
400
|
if (context.isChatInput())
|
|
407
401
|
return await this.resolveChatInput(context);
|
|
408
|
-
if (context.isMessage())
|
|
402
|
+
if (context.isMessage()) {
|
|
403
|
+
let { required, name } = this.options;
|
|
404
|
+
if (value === void 0) {
|
|
405
|
+
if (required)
|
|
406
|
+
throw new ArgumentError(name, "is required");
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
409
|
return await this.resolveMessage(context, value);
|
|
410
|
+
}
|
|
410
411
|
throw new Error("Invalid context type provided");
|
|
411
412
|
}
|
|
412
413
|
/**
|
|
@@ -734,7 +735,8 @@ function createFactory(ctor) {
|
|
|
734
735
|
}
|
|
735
736
|
var Params = {
|
|
736
737
|
string: createFactory(StringParam),
|
|
737
|
-
number: createFactory(NumberParam)
|
|
738
|
+
number: createFactory(NumberParam),
|
|
739
|
+
user: createFactory(UserParam)
|
|
738
740
|
};
|
|
739
741
|
|
|
740
742
|
// src/defaults/command.ts
|