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.
- package/lib/bot-service.d.ts +1 -1
- package/lib/bot-service.js +8 -20
- package/lib/bot-struct.d.ts +1 -1
- package/package.json +1 -1
- package/src/bot-service.ts +3 -3
- package/src/bot-struct.ts +1 -1
package/lib/bot-service.d.ts
CHANGED
|
@@ -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
|
|
27
|
+
export declare function CallbackAction(descriptor: string): Action;
|
|
28
28
|
export declare function WaitForData(descriptor: string): Action;
|
|
29
29
|
export {};
|
package/lib/bot-service.js
CHANGED
|
@@ -372,29 +372,17 @@ var BotBuilder = /** @class */ (function () {
|
|
|
372
372
|
}());
|
|
373
373
|
exports.BotBuilder = BotBuilder;
|
|
374
374
|
function ChangeDialog(id) {
|
|
375
|
-
|
|
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
|
-
|
|
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
|
-
|
|
394
|
-
|
|
395
|
-
|
|
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) {
|
package/lib/bot-struct.d.ts
CHANGED
|
@@ -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
package/src/bot-service.ts
CHANGED
|
@@ -185,10 +185,10 @@ export class BotBuilder {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
export function ChangeDialog(id: string): Action {
|
|
188
|
-
return
|
|
188
|
+
return (chat: number, _bot: BotBuilder) => { return _bot.ChangeDialog(chat, id); };
|
|
189
189
|
}
|
|
190
|
-
export function CallbackAction(descriptor: string
|
|
191
|
-
return
|
|
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;
|