telegram-botbuilder 1.0.17 → 1.0.18

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.
@@ -24,6 +24,6 @@ export declare class BotBuilder {
24
24
  Message(chat: number, content: string): Promise<TelegramBot.Message>;
25
25
  }
26
26
  export declare function ChangeDialog(id: string): Action;
27
- export declare function CallbackAction(descriptor: string, ...args: any[]): Action;
27
+ export declare function CallbackAction(descriptor: string): Action;
28
28
  export declare function WaitForData(descriptor: string): Action;
29
29
  export {};
@@ -372,29 +372,17 @@ var BotBuilder = /** @class */ (function () {
372
372
  }());
373
373
  exports.BotBuilder = BotBuilder;
374
374
  function ChangeDialog(id) {
375
- var _this = this;
376
- return function (chat, _bot) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
377
- switch (_a.label) {
378
- case 0: return [4 /*yield*/, _bot.ChangeDialog(chat, id)];
379
- case 1:
380
- _a.sent();
381
- return [2 /*return*/];
382
- }
383
- }); }); };
375
+ return function (chat, _bot) { return _bot.ChangeDialog(chat, id); };
384
376
  }
385
377
  function CallbackAction(descriptor) {
386
- var _this = this;
387
- var args = [];
388
- for (var _i = 1; _i < arguments.length; _i++) {
389
- args[_i - 1] = arguments[_i];
390
- }
391
- return function (chat, _bot) { return __awaiter(_this, void 0, void 0, function () {
378
+ return function (chat, _bot) {
392
379
  var _a;
393
- return __generator(this, function (_b) {
394
- (_a = _bot.ActionSystem).emit.apply(_a, __spreadArray([descriptor, chat], args, false));
395
- return [2 /*return*/];
396
- });
397
- }); };
380
+ var args = [];
381
+ for (var _i = 2; _i < arguments.length; _i++) {
382
+ args[_i - 2] = arguments[_i];
383
+ }
384
+ (_a = _bot.ActionSystem).emit.apply(_a, __spreadArray([descriptor, chat], args, false));
385
+ };
398
386
  }
399
387
  function WaitForData(descriptor) {
400
388
  return function (chat, _bot) {
@@ -1,5 +1,5 @@
1
1
  import { BotBuilder } from "./bot-service";
2
- export type Action = (chat: number, _bot: BotBuilder, ...args: any[]) => Promise<void>;
2
+ export type Action = (chat: number, _bot: BotBuilder, ...args: any[]) => Promise<void> | void;
3
3
  export interface Dialog {
4
4
  id: string;
5
5
  text: string | ((chat: number) => Promise<string>) | ((chat: number) => string);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "telegram-botbuilder",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "main": "lib/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -185,10 +185,10 @@ export class BotBuilder {
185
185
  }
186
186
 
187
187
  export function ChangeDialog(id: string): Action {
188
- return async (chat: number, _bot: BotBuilder) => { await _bot.ChangeDialog(chat, id); };
188
+ return (chat: number, _bot: BotBuilder) => { return _bot.ChangeDialog(chat, id); };
189
189
  }
190
- export function CallbackAction(descriptor: string, ...args: any[]): Action {
191
- return async (chat: number, _bot: BotBuilder) => { _bot.ActionSystem.emit(descriptor, chat, ...args); };
190
+ export function CallbackAction(descriptor: string): Action {
191
+ return (chat: number, _bot: BotBuilder, ...args: any[]) => { _bot.ActionSystem.emit(descriptor, chat, ...args); };
192
192
  }
193
193
  export function WaitForData(descriptor: string): Action {
194
194
  return (chat: number, _bot: BotBuilder) => {
package/src/bot-struct.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BotBuilder } from "./bot-service";
2
2
 
3
3
 
4
- export type Action = (chat: number, _bot: BotBuilder, ...args: any[]) => Promise<void>;
4
+ export type Action = (chat: number, _bot: BotBuilder, ...args: any[]) => Promise<void> | void;
5
5
 
6
6
  export interface Dialog {
7
7
  id: string;