telegram-botbuilder 1.0.9 → 1.0.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.
@@ -132,50 +132,42 @@ var BotBuilder = /** @class */ (function () {
132
132
  }); });
133
133
  this._bot.onText(/\/start/, function (msg) { return __awaiter(_this, void 0, void 0, function () {
134
134
  return __generator(this, function (_a) {
135
- switch (_a.label) {
136
- case 0: return [4 /*yield*/, this._runmw(msg.chat.id, msg)];
137
- case 1:
138
- if (_a.sent())
139
- return [2 /*return*/];
140
- if (!this._userdialogs[msg.chat.id])
141
- this._userdialogs[msg.chat.id] = { dialog: this._schema.start, lastid: -1, waiter: { statewait: false, descriptor: '' } };
142
- this._bot.deleteMessage(msg.chat.id, msg.message_id).catch(function () { return undefined; });
143
- this.ChangeDialog(msg.chat.id, this._schema.start);
144
- return [2 /*return*/];
145
- }
135
+ //if (await this._runmw(msg.chat.id, msg)) return;
136
+ if (!this._userdialogs[msg.chat.id])
137
+ this._userdialogs[msg.chat.id] = { dialog: this._schema.start, lastid: -1, waiter: { statewait: false, descriptor: '' } };
138
+ this._bot.deleteMessage(msg.chat.id, msg.message_id).catch(function () { return undefined; });
139
+ this.ChangeDialog(msg.chat.id, this._schema.start);
140
+ return [2 /*return*/];
146
141
  });
147
142
  }); });
148
143
  var _loop_1 = function (cmd) {
149
- this_1._bot.onText(new RegExp('\\/${cmd.text}(?:\\s+(.*))?$'), function (msg, match) { return __awaiter(_this, void 0, void 0, function () {
144
+ this_1._bot.onText(new RegExp("\\/".concat(cmd.text, "(?:\\s+(.*))?$")), function (msg, match) { return __awaiter(_this, void 0, void 0, function () {
150
145
  var chat, _i, _a, act;
151
146
  return __generator(this, function (_b) {
152
147
  switch (_b.label) {
153
- case 0: return [4 /*yield*/, this._runmw(msg.chat.id, msg)];
154
- case 1:
155
- if (_b.sent())
156
- return [2 /*return*/];
148
+ case 0:
157
149
  chat = msg.chat.id;
158
- if (!Array.isArray(cmd === null || cmd === void 0 ? void 0 : cmd.action)) return [3 /*break*/, 6];
150
+ if (!Array.isArray(cmd === null || cmd === void 0 ? void 0 : cmd.action)) return [3 /*break*/, 5];
159
151
  _i = 0, _a = cmd === null || cmd === void 0 ? void 0 : cmd.action;
160
- _b.label = 2;
161
- case 2:
162
- if (!(_i < _a.length)) return [3 /*break*/, 5];
152
+ _b.label = 1;
153
+ case 1:
154
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
163
155
  act = _a[_i];
164
156
  return [4 /*yield*/, act(chat, this, match[1])];
165
- case 3:
157
+ case 2:
166
158
  _b.sent();
167
- _b.label = 4;
168
- case 4:
159
+ _b.label = 3;
160
+ case 3:
169
161
  _i++;
170
- return [3 /*break*/, 2];
171
- case 5: return [3 /*break*/, 8];
172
- case 6:
173
- if (!(cmd === null || cmd === void 0 ? void 0 : cmd.action)) return [3 /*break*/, 8];
162
+ return [3 /*break*/, 1];
163
+ case 4: return [3 /*break*/, 7];
164
+ case 5:
165
+ if (!(cmd === null || cmd === void 0 ? void 0 : cmd.action)) return [3 /*break*/, 7];
174
166
  return [4 /*yield*/, (cmd === null || cmd === void 0 ? void 0 : cmd.action)(chat, this, match[1])];
175
- case 7:
167
+ case 6:
176
168
  _b.sent();
177
- _b.label = 8;
178
- case 8: return [2 /*return*/];
169
+ _b.label = 7;
170
+ case 7: return [2 /*return*/];
179
171
  }
180
172
  });
181
173
  }); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-botbuilder",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "main": "lib/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -84,7 +84,7 @@ export class BotBuilder {
84
84
  });
85
85
 
86
86
  this._bot.onText(/\/start/, async (msg) => {
87
- if (await this._runmw(msg.chat.id, msg)) return;
87
+ //if (await this._runmw(msg.chat.id, msg)) return;
88
88
 
89
89
  if (!this._userdialogs[msg.chat.id]) this._userdialogs[msg.chat.id] = {dialog: this._schema.start, lastid: -1, waiter: { statewait: false, descriptor: '' }}
90
90
  this._bot.deleteMessage(msg.chat.id, msg.message_id).catch(() => undefined);
@@ -92,8 +92,8 @@ export class BotBuilder {
92
92
  });
93
93
 
94
94
  for (let cmd of this._schema.commands) {
95
- this._bot.onText(new RegExp('\\/${cmd.text}(?:\\s+(.*))?$'), async (msg, match) => {
96
- if (await this._runmw(msg.chat.id, msg)) return;
95
+ this._bot.onText(new RegExp(`\\/${cmd.text}(?:\\s+(.*))?$`), async (msg, match) => {
96
+ //if (await this._runmw(msg.chat.id, msg)) return;
97
97
 
98
98
  let chat = msg.chat.id;
99
99
  if (Array.isArray(cmd?.action)) {