gramio 0.4.8 → 0.4.10
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.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils.cjs +0 -0
- package/dist/utils.js +0 -0
- package/package.json +11 -9
package/dist/index.cjs
CHANGED
|
@@ -996,7 +996,7 @@ class Bot {
|
|
|
996
996
|
hears(trigger, handler) {
|
|
997
997
|
return this.on("message", (context, next) => {
|
|
998
998
|
const text = context.text ?? context.caption;
|
|
999
|
-
if (typeof trigger === "string" && text === trigger || // @ts-expect-error
|
|
999
|
+
if (typeof trigger === "string" && text === trigger || Array.isArray(trigger) && text && trigger.includes(text) || // @ts-expect-error
|
|
1000
1000
|
typeof trigger === "function" && trigger(context) || trigger instanceof RegExp && text && trigger.test(text)) {
|
|
1001
1001
|
context.args = trigger instanceof RegExp ? text?.match(trigger) : null;
|
|
1002
1002
|
return handler(context);
|
package/dist/index.d.cts
CHANGED
|
@@ -967,7 +967,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
967
967
|
* if (context.args) await context.send(`Params ${context.args[1]}`);
|
|
968
968
|
* });
|
|
969
969
|
*/
|
|
970
|
-
hears<Ctx = ContextType<typeof this, "message">, Trigger extends RegExp | string | ((context: Ctx) => boolean) = RegExp | string | ((context: Ctx) => boolean)>(trigger: Trigger, handler: (context: Ctx & {
|
|
970
|
+
hears<Ctx = ContextType<typeof this, "message">, Trigger extends RegExp | MaybeArray<string> | ((context: Ctx) => boolean) = RegExp | MaybeArray<string> | ((context: Ctx) => boolean)>(trigger: Trigger, handler: (context: Ctx & {
|
|
971
971
|
args: RegExpMatchArray | null;
|
|
972
972
|
}) => unknown): this;
|
|
973
973
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -967,7 +967,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
967
967
|
* if (context.args) await context.send(`Params ${context.args[1]}`);
|
|
968
968
|
* });
|
|
969
969
|
*/
|
|
970
|
-
hears<Ctx = ContextType<typeof this, "message">, Trigger extends RegExp | string | ((context: Ctx) => boolean) = RegExp | string | ((context: Ctx) => boolean)>(trigger: Trigger, handler: (context: Ctx & {
|
|
970
|
+
hears<Ctx = ContextType<typeof this, "message">, Trigger extends RegExp | MaybeArray<string> | ((context: Ctx) => boolean) = RegExp | MaybeArray<string> | ((context: Ctx) => boolean)>(trigger: Trigger, handler: (context: Ctx & {
|
|
971
971
|
args: RegExpMatchArray | null;
|
|
972
972
|
}) => unknown): this;
|
|
973
973
|
/**
|
package/dist/index.js
CHANGED
|
@@ -998,7 +998,7 @@ class Bot {
|
|
|
998
998
|
hears(trigger, handler) {
|
|
999
999
|
return this.on("message", (context, next) => {
|
|
1000
1000
|
const text = context.text ?? context.caption;
|
|
1001
|
-
if (typeof trigger === "string" && text === trigger || // @ts-expect-error
|
|
1001
|
+
if (typeof trigger === "string" && text === trigger || Array.isArray(trigger) && text && trigger.includes(text) || // @ts-expect-error
|
|
1002
1002
|
typeof trigger === "function" && trigger(context) || trigger instanceof RegExp && text && trigger.test(text)) {
|
|
1003
1003
|
context.args = trigger instanceof RegExp ? text?.match(trigger) : null;
|
|
1004
1004
|
return handler(context);
|
package/dist/utils.cjs
CHANGED
|
File without changes
|
package/dist/utils.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gramio",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.10",
|
|
5
5
|
"description": "Powerful, extensible and really type-safe Telegram Bot API framework",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -55,22 +55,24 @@
|
|
|
55
55
|
"author": "kravets",
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@biomejs/biome": "1.
|
|
59
|
-
"@types/bun": "^1.2.
|
|
58
|
+
"@biomejs/biome": "2.1.1",
|
|
59
|
+
"@types/bun": "^1.2.18",
|
|
60
60
|
"@types/debug": "^4.1.12",
|
|
61
|
-
"expect-type": "^1.2.
|
|
62
|
-
"pkgroll": "^2.
|
|
61
|
+
"expect-type": "^1.2.2",
|
|
62
|
+
"pkgroll": "^2.14.1",
|
|
63
63
|
"typescript": "^5.8.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@gramio/callback-data": "^0.0.3",
|
|
67
|
-
"@gramio/contexts": "^0.
|
|
67
|
+
"@gramio/contexts": "^0.3.0",
|
|
68
68
|
"@gramio/files": "^0.3.0",
|
|
69
|
-
"@gramio/format": "^0.
|
|
69
|
+
"@gramio/format": "^0.3.3",
|
|
70
70
|
"@gramio/keyboards": "^1.2.1",
|
|
71
|
-
"@gramio/types": "^9.
|
|
71
|
+
"@gramio/types": "^9.1.3",
|
|
72
72
|
"debug": "^4.4.1",
|
|
73
73
|
"middleware-io": "^2.8.1"
|
|
74
74
|
},
|
|
75
|
-
"files": [
|
|
75
|
+
"files": [
|
|
76
|
+
"dist"
|
|
77
|
+
]
|
|
76
78
|
}
|