@aracna/telegram-bot 1.9.11 → 1.9.12
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/modules/telegram.js +6 -1
- package/package.json +1 -1
- package/utils/context.utils.js +3 -5
package/modules/telegram.js
CHANGED
|
@@ -119,7 +119,12 @@ class Telegram {
|
|
|
119
119
|
handler.type = type;
|
|
120
120
|
handler.options = (0, core_1.mergeObjects)(handler.options, options ?? {});
|
|
121
121
|
potential = this.findMatchingHandler(handler.type, handler.key);
|
|
122
|
-
|
|
122
|
+
if (potential.id) {
|
|
123
|
+
potential.middleware = middleware;
|
|
124
|
+
module_logger_1.ModuleLogger.debug('Telegram', 'register', `The handler has been updated.`, handler);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
this.handlers.push(handler);
|
|
123
128
|
module_logger_1.ModuleLogger.debug('Telegram', 'register', `The handler has been registered.`, handler);
|
|
124
129
|
}
|
|
125
130
|
handle(update) {
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"directory": "dist"
|
|
28
28
|
},
|
|
29
29
|
"types": "index.d.ts",
|
|
30
|
-
"version": "1.9.
|
|
30
|
+
"version": "1.9.12",
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "rm -rf dist && pnpm tsc && pnpm api-extractor run --local",
|
|
33
33
|
"prepublish": "pnpm test && pnpm build && pnpm version patch && cp LICENSE package.json README.md dist",
|
package/utils/context.utils.js
CHANGED
|
@@ -32,12 +32,10 @@ class ContextUtils {
|
|
|
32
32
|
return this.getUser(context).username ?? '';
|
|
33
33
|
}
|
|
34
34
|
static getUser(context) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return (0, core_1.getObjectProperty)(context, 'from', { first_name: '', id: 0, is_bot: false, username: '' });
|
|
38
|
-
default:
|
|
39
|
-
return { first_name: '', id: 0, is_bot: false, username: '' };
|
|
35
|
+
if ((0, core_1.hasObjectProperty)(context, 'from')) {
|
|
36
|
+
return (0, core_1.getObjectProperty)(context, 'from', { first_name: '', id: 0, is_bot: false, username: '' });
|
|
40
37
|
}
|
|
38
|
+
return { first_name: '', id: 0, is_bot: false, username: '' };
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
exports.ContextUtils = ContextUtils;
|