telegram-botbuilder 1.0.7 → 1.0.8

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.
@@ -22,6 +22,6 @@ export declare class BotBuilder {
22
22
  Message(chat: number, content: string): Promise<TelegramBot.Message>;
23
23
  }
24
24
  export declare function ChangeDialog(id: string): Action;
25
- export declare function CallbackAction(descriptor: string): Action;
25
+ export declare function CallbackAction(descriptor: string, ...args: any[]): Action;
26
26
  export declare function WaitForData(descriptor: string): Action;
27
27
  export {};
@@ -35,6 +35,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
+ if (ar || !(i in from)) {
41
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
+ ar[i] = from[i];
43
+ }
44
+ }
45
+ return to.concat(ar || Array.prototype.slice.call(from));
46
+ };
38
47
  var __importDefault = (this && this.__importDefault) || function (mod) {
39
48
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
49
  };
@@ -337,10 +346,17 @@ function ChangeDialog(id) {
337
346
  }
338
347
  function CallbackAction(descriptor) {
339
348
  var _this = this;
340
- return function (chat, _bot) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
341
- _bot.ActionSystem.emit(descriptor, { chatid: chat });
342
- return [2 /*return*/];
343
- }); }); };
349
+ var args = [];
350
+ for (var _i = 1; _i < arguments.length; _i++) {
351
+ args[_i - 1] = arguments[_i];
352
+ }
353
+ return function (chat, _bot) { return __awaiter(_this, void 0, void 0, function () {
354
+ var _a;
355
+ return __generator(this, function (_b) {
356
+ (_a = _bot.ActionSystem).emit.apply(_a, __spreadArray([descriptor, chat], args, false));
357
+ return [2 /*return*/];
358
+ });
359
+ }); };
344
360
  }
345
361
  function WaitForData(descriptor) {
346
362
  return function (chat, _bot) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-botbuilder",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "main": "lib/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -163,8 +163,8 @@ export class BotBuilder {
163
163
  export function ChangeDialog(id: string): Action {
164
164
  return async (chat: number, _bot: BotBuilder) => { await _bot.ChangeDialog(chat, id); };
165
165
  }
166
- export function CallbackAction(descriptor: string): Action {
167
- return async (chat: number, _bot: BotBuilder) => { _bot.ActionSystem.emit(descriptor, {chatid: chat}); };
166
+ export function CallbackAction(descriptor: string, ...args: any[]): Action {
167
+ return async (chat: number, _bot: BotBuilder) => { _bot.ActionSystem.emit(descriptor, chat, ...args); };
168
168
  }
169
169
  export function WaitForData(descriptor: string): Action {
170
170
  return (chat: number, _bot: BotBuilder) => {