chz-telegram-bot 0.5.5 → 0.6.9
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/README.md +41 -31
- package/dist/entities/actions/commandAction.d.ts.map +1 -1
- package/dist/entities/actions/commandAction.js +11 -1
- package/dist/entities/actions/inlineQueryAction.d.ts.map +1 -1
- package/dist/entities/actions/inlineQueryAction.js +9 -1
- package/dist/entities/actions/replyCaptureAction.d.ts.map +1 -1
- package/dist/entities/actions/replyCaptureAction.js +9 -1
- package/dist/entities/actions/scheduledAction.d.ts.map +1 -1
- package/dist/entities/actions/scheduledAction.js +24 -4
- package/dist/entities/botInstance.d.ts +3 -4
- package/dist/entities/botInstance.d.ts.map +1 -1
- package/dist/entities/botInstance.js +13 -11
- package/dist/entities/context/baseContext.d.ts +4 -4
- package/dist/entities/context/baseContext.d.ts.map +1 -1
- package/dist/entities/context/baseContext.js +3 -2
- package/dist/eslint.config.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/main.d.ts +0 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -2
- package/dist/services/actionProcessingService.d.ts +4 -4
- package/dist/services/actionProcessingService.d.ts.map +1 -1
- package/dist/services/actionProcessingService.js +10 -10
- package/dist/services/actionProcessors/baseProcessor.d.ts +3 -3
- package/dist/services/actionProcessors/baseProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/baseProcessor.js +9 -5
- package/dist/services/actionProcessors/commandActionProcessor.d.ts +2 -3
- package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/commandActionProcessor.js +32 -18
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/inlineQueryActionProcessor.js +16 -8
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts +2 -2
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/scheduledActionProcessor.js +4 -4
- package/dist/services/jsonFileStorage.d.ts +3 -1
- package/dist/services/jsonFileStorage.d.ts.map +1 -1
- package/dist/services/jsonFileStorage.js +26 -2
- package/dist/services/nodeTimeoutScheduler.d.ts +3 -3
- package/dist/services/nodeTimeoutScheduler.d.ts.map +1 -1
- package/dist/services/nodeTimeoutScheduler.js +27 -8
- package/dist/services/telegramApi.d.ts +4 -4
- package/dist/services/telegramApi.d.ts.map +1 -1
- package/dist/services/telegramApi.js +39 -9
- package/dist/types/events.d.ts +193 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +69 -0
- package/dist/types/logger.d.ts +0 -12
- package/dist/types/logger.d.ts.map +1 -1
- package/dist/types/logger.js +1 -1
- package/entities/actions/commandAction.ts +11 -3
- package/entities/actions/inlineQueryAction.ts +9 -1
- package/entities/actions/replyCaptureAction.ts +9 -3
- package/entities/actions/scheduledAction.ts +31 -10
- package/entities/botInstance.ts +18 -25
- package/entities/context/baseContext.ts +9 -4
- package/index.ts +1 -1
- package/main.ts +1 -10
- package/package.json +1 -1
- package/services/actionProcessingService.ts +11 -15
- package/services/actionProcessors/baseProcessor.ts +9 -9
- package/services/actionProcessors/commandActionProcessor.ts +35 -46
- package/services/actionProcessors/inlineQueryActionProcessor.ts +24 -20
- package/services/actionProcessors/scheduledActionProcessor.ts +7 -10
- package/services/jsonFileStorage.ts +27 -1
- package/services/nodeTimeoutScheduler.ts +22 -22
- package/services/telegramApi.ts +53 -23
- package/types/events.ts +285 -0
- package/dist/services/jsonLogger.d.ts +0 -11
- package/dist/services/jsonLogger.d.ts.map +0 -1
- package/dist/services/jsonLogger.js +0 -66
- package/services/jsonLogger.ts +0 -112
- package/types/logger.ts +0 -39
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ILogger } from '../../types/logger';
|
|
2
1
|
import { IScheduler } from '../../types/scheduler';
|
|
3
2
|
import { IStorageClient } from '../../types/storage';
|
|
4
3
|
import { TelegramApiService } from '../telegramApi';
|
|
5
4
|
import { IAction } from '../../types/action';
|
|
6
5
|
import { BaseContextInternal } from '../../entities/context/baseContext';
|
|
6
|
+
import { TypedEventEmitter } from '../../types/events';
|
|
7
7
|
export declare abstract class BaseActionProcessor {
|
|
8
8
|
protected readonly storage: IStorageClient;
|
|
9
9
|
protected readonly scheduler: IScheduler;
|
|
10
|
-
protected readonly
|
|
10
|
+
protected readonly eventEmitter: TypedEventEmitter;
|
|
11
11
|
protected readonly botName: string;
|
|
12
12
|
protected api: TelegramApiService;
|
|
13
|
-
constructor(botName: string, storage: IStorageClient, scheduler: IScheduler,
|
|
13
|
+
constructor(botName: string, storage: IStorageClient, scheduler: IScheduler, eventEmitter: TypedEventEmitter);
|
|
14
14
|
private defaultErrorHandler;
|
|
15
15
|
initializeDependencies(api: TelegramApiService): void;
|
|
16
16
|
executeAction<TAction extends IAction, TActionContext extends BaseContextInternal<TAction>>(action: TAction, ctx: TActionContext, errorHandler?: (error: Error, ctx: TActionContext) => void): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/baseProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"baseProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/baseProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAgB,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAErE,8BAAsB,mBAAmB;IACrC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IAC3C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IACzC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IAEnD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEnC,SAAS,CAAC,GAAG,EAAG,kBAAkB,CAAC;gBAG/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,UAAU,EACrB,YAAY,EAAE,iBAAiB;IASnC,OAAO,CAAC,mBAAmB;IAI3B,sBAAsB,CAAC,GAAG,EAAE,kBAAkB;IAIxC,aAAa,CACf,OAAO,SAAS,OAAO,EACvB,cAAc,SAAS,mBAAmB,CAAC,OAAO,CAAC,EAEnD,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,cAAc,EACnB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,KAAK,IAAI;CAajE"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import { BotEventType } from '../../types/events';
|
|
1
2
|
export class BaseActionProcessor {
|
|
2
3
|
storage;
|
|
3
4
|
scheduler;
|
|
4
|
-
|
|
5
|
+
eventEmitter;
|
|
5
6
|
botName;
|
|
6
7
|
api;
|
|
7
|
-
constructor(botName, storage, scheduler,
|
|
8
|
+
constructor(botName, storage, scheduler, eventEmitter) {
|
|
8
9
|
this.storage = storage;
|
|
9
10
|
this.scheduler = scheduler;
|
|
10
|
-
this.
|
|
11
|
+
this.eventEmitter = eventEmitter;
|
|
11
12
|
this.botName = botName;
|
|
12
13
|
}
|
|
13
|
-
defaultErrorHandler(error
|
|
14
|
-
|
|
14
|
+
defaultErrorHandler(error) {
|
|
15
|
+
this.eventEmitter.emit(BotEventType.error, { error });
|
|
15
16
|
}
|
|
16
17
|
initializeDependencies(api) {
|
|
17
18
|
this.api = api;
|
|
@@ -24,6 +25,9 @@ export class BaseActionProcessor {
|
|
|
24
25
|
}
|
|
25
26
|
catch (error) {
|
|
26
27
|
(errorHandler ?? this.defaultErrorHandler)(error, ctx);
|
|
28
|
+
this.eventEmitter.emit(BotEventType.error, {
|
|
29
|
+
error: error
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
}
|
|
@@ -2,7 +2,6 @@ import { CommandAction } from '../../entities/actions/commandAction';
|
|
|
2
2
|
import { IActionState } from '../../types/actionState';
|
|
3
3
|
import { TelegramApiService } from '../telegramApi';
|
|
4
4
|
import { IReplyCapture } from '../../types/capture';
|
|
5
|
-
import { TraceId } from '../../types/trace';
|
|
6
5
|
import { ChatInfo } from '../../dtos/chatInfo';
|
|
7
6
|
import { BaseActionProcessor } from './baseProcessor';
|
|
8
7
|
import { BotInfo, TelegramBot } from '../../types/externalAliases';
|
|
@@ -11,8 +10,8 @@ export declare class CommandActionProcessor extends BaseActionProcessor {
|
|
|
11
10
|
private readonly chatHistory;
|
|
12
11
|
private botInfo;
|
|
13
12
|
private commands;
|
|
14
|
-
initialize(api: TelegramApiService, telegram: TelegramBot, commands: CommandAction<IActionState>[],
|
|
15
|
-
captureRegistrationCallback(capture: IReplyCapture, parentMessageId: number, chatInfo: ChatInfo
|
|
13
|
+
initialize(api: TelegramApiService, telegram: TelegramBot, commands: CommandAction<IActionState>[], botInfo: BotInfo): void;
|
|
14
|
+
captureRegistrationCallback(capture: IReplyCapture, parentMessageId: number, chatInfo: ChatInfo): void;
|
|
16
15
|
private processMessage;
|
|
17
16
|
private initializeReplyCaptureContext;
|
|
18
17
|
private initializeMessageContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandActionProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/commandActionProcessor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAIrE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"commandActionProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/commandActionProcessor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAIrE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAM/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKtD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAKnE,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IACxE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2C;IACvE,OAAO,CAAC,OAAO,CAAW;IAE1B,OAAO,CAAC,QAAQ,CAKd;IAEF,UAAU,CACN,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,WAAW,EACrB,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,EAAE,EACvC,OAAO,EAAE,OAAO;IAoDpB,2BAA2B,CACvB,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ;YA4BR,cAAc;IAkE5B,OAAO,CAAC,6BAA6B;IA2BrC,OAAO,CAAC,wBAAwB;CA6BnC"}
|
|
@@ -9,6 +9,7 @@ import { getOrSetIfNotExists } from '../../helpers/mapUtils';
|
|
|
9
9
|
import { MessageInfo } from '../../dtos/messageInfo';
|
|
10
10
|
import { UserInfo } from '../../dtos/userInfo';
|
|
11
11
|
import { ChatHistoryMessage } from '../../dtos/chatHistoryMessage';
|
|
12
|
+
import { BotEventType } from '../../types/events';
|
|
12
13
|
const MESSAGE_HISTORY_LENGTH_LIMIT = 100;
|
|
13
14
|
export class CommandActionProcessor extends BaseActionProcessor {
|
|
14
15
|
replyCaptures = [];
|
|
@@ -18,7 +19,7 @@ export class CommandActionProcessor extends BaseActionProcessor {
|
|
|
18
19
|
x,
|
|
19
20
|
[]
|
|
20
21
|
]));
|
|
21
|
-
initialize(api, telegram, commands,
|
|
22
|
+
initialize(api, telegram, commands, botInfo) {
|
|
22
23
|
this.botInfo = botInfo;
|
|
23
24
|
this.initializeDependencies(api);
|
|
24
25
|
for (const msgType of Object.values(MessageType)) {
|
|
@@ -34,48 +35,63 @@ export class CommandActionProcessor extends BaseActionProcessor {
|
|
|
34
35
|
cmd.triggers.includes(MessageType.Any));
|
|
35
36
|
}
|
|
36
37
|
if (commands.length > 0) {
|
|
37
|
-
telegram.on('message', ({ message }) => {
|
|
38
|
+
telegram.on('message', async ({ message }) => {
|
|
38
39
|
const internalMessage = new IncomingMessage(message, this.botName, getOrSetIfNotExists(this.chatHistory, message.chat.id, []));
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
this.eventEmitter.emit(BotEventType.messageRecieved, {
|
|
41
|
+
botInfo: this.botInfo,
|
|
42
|
+
message: internalMessage
|
|
43
|
+
});
|
|
44
|
+
await this.processMessage(internalMessage);
|
|
45
|
+
this.eventEmitter.emit(BotEventType.messageProcessingFinished, {
|
|
46
|
+
botInfo: this.botInfo,
|
|
47
|
+
message: internalMessage
|
|
48
|
+
});
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
|
-
captureRegistrationCallback(capture, parentMessageId, chatInfo
|
|
52
|
+
captureRegistrationCallback(capture, parentMessageId, chatInfo) {
|
|
51
53
|
const replyAction = new ReplyCaptureAction(parentMessageId, capture.action, capture.handler, capture.trigger, capture.abortController);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
this.eventEmitter.emit(BotEventType.commandActionCaptureStarted, {
|
|
55
|
+
parentMessageId,
|
|
56
|
+
chatInfo
|
|
57
|
+
});
|
|
54
58
|
this.replyCaptures.push(replyAction);
|
|
55
59
|
capture.abortController.signal.addEventListener('abort', () => {
|
|
56
60
|
const index = this.replyCaptures.indexOf(replyAction);
|
|
57
61
|
this.replyCaptures.splice(index, 1);
|
|
58
|
-
|
|
62
|
+
this.eventEmitter.emit(BotEventType.commandActionCaptureAborted, {
|
|
63
|
+
parentMessageId,
|
|
64
|
+
chatInfo
|
|
65
|
+
});
|
|
59
66
|
});
|
|
60
67
|
}
|
|
61
68
|
async processMessage(msg) {
|
|
69
|
+
this.eventEmitter.emit(BotEventType.messageProcessingStarted, {
|
|
70
|
+
botInfo: this.botInfo,
|
|
71
|
+
message: msg
|
|
72
|
+
});
|
|
62
73
|
const chatHistoryArray = getOrSetIfNotExists(this.chatHistory, msg.chatInfo.id, []);
|
|
63
74
|
while (chatHistoryArray.length > MESSAGE_HISTORY_LENGTH_LIMIT)
|
|
64
75
|
chatHistoryArray.shift();
|
|
65
76
|
chatHistoryArray.push(new ChatHistoryMessage(msg.messageId, msg.from, msg.text, msg.type, msg.traceId, msg.replyToMessageId, msg.updateObject.date));
|
|
66
|
-
const ctx = new MessageContextInternal(this.storage, this.scheduler);
|
|
77
|
+
const ctx = new MessageContextInternal(this.storage, this.scheduler, this.eventEmitter);
|
|
67
78
|
const commandsToCheck = new Set(this.commands[msg.type]);
|
|
68
79
|
if (msg.type != MessageType.Text && msg.text != '') {
|
|
69
80
|
for (const command of this.commands[MessageType.Text]) {
|
|
70
81
|
commandsToCheck.add(command);
|
|
71
82
|
}
|
|
72
83
|
}
|
|
84
|
+
this.eventEmitter.emit(BotEventType.beforeActionsExecuting, {
|
|
85
|
+
botInfo: this.botInfo,
|
|
86
|
+
message: msg,
|
|
87
|
+
commands: commandsToCheck
|
|
88
|
+
});
|
|
73
89
|
for (const commandAction of commandsToCheck) {
|
|
74
90
|
this.initializeMessageContext(ctx, commandAction, msg);
|
|
75
91
|
await this.executeAction(commandAction, ctx);
|
|
76
92
|
}
|
|
77
93
|
if (this.replyCaptures.length != 0) {
|
|
78
|
-
const replyCtx = new ReplyContextInternal(this.storage, this.scheduler);
|
|
94
|
+
const replyCtx = new ReplyContextInternal(this.storage, this.scheduler, this.eventEmitter);
|
|
79
95
|
for (const replyAction of this.replyCaptures) {
|
|
80
96
|
this.initializeReplyCaptureContext(replyCtx, replyAction, msg);
|
|
81
97
|
await this.executeAction(replyAction, replyCtx);
|
|
@@ -95,7 +111,6 @@ export class CommandActionProcessor extends BaseActionProcessor {
|
|
|
95
111
|
ctx.botInfo = this.botInfo;
|
|
96
112
|
ctx.isInitialized = true;
|
|
97
113
|
ctx.matchResults = [];
|
|
98
|
-
ctx.logger = this.logger.createScope(this.botName, message.traceId, message.chatInfo.name);
|
|
99
114
|
}
|
|
100
115
|
initializeMessageContext(ctx, action, message) {
|
|
101
116
|
ctx.messageInfo = new MessageInfo(message.messageId, message.text, message.type, message.updateObject);
|
|
@@ -111,6 +126,5 @@ export class CommandActionProcessor extends BaseActionProcessor {
|
|
|
111
126
|
ctx.traceId = message.traceId;
|
|
112
127
|
ctx.botInfo = this.botInfo;
|
|
113
128
|
ctx.customCooldown = undefined;
|
|
114
|
-
ctx.logger = this.logger.createScope(this.botName, message.traceId, message.chatInfo.name);
|
|
115
129
|
}
|
|
116
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineQueryActionProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/inlineQueryActionProcessor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"inlineQueryActionProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/inlineQueryActionProcessor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAI7E,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,qBAAa,0BAA2B,SAAQ,mBAAmB;IAC/D,OAAO,CAAC,aAAa,CAAuB;IAE5C,UAAU,CACN,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,WAAW,EACrB,aAAa,EAAE,iBAAiB,EAAE,EAClC,MAAM,EAAE,YAAY;IA4GxB,OAAO,CAAC,4BAA4B;CAmBvC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IncomingInlineQuery } from '../../dtos/incomingQuery';
|
|
2
2
|
import { InlineQueryContextInternal } from '../../entities/context/inlineQueryContext';
|
|
3
3
|
import { createTrace } from '../../helpers/traceFactory';
|
|
4
|
+
import { BotEventType } from '../../types/events';
|
|
4
5
|
import { BaseActionProcessor } from './baseProcessor';
|
|
5
6
|
export class InlineQueryActionProcessor extends BaseActionProcessor {
|
|
6
7
|
inlineQueries;
|
|
@@ -12,11 +13,15 @@ export class InlineQueryActionProcessor extends BaseActionProcessor {
|
|
|
12
13
|
if (this.inlineQueries.length > 0) {
|
|
13
14
|
telegram.on('inline_query', ({ inlineQuery }) => {
|
|
14
15
|
const query = new IncomingInlineQuery(inlineQuery.id, inlineQuery.query, inlineQuery.from.id, createTrace('InlineQuery', this.botName, inlineQuery.id));
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
this.eventEmitter.emit(BotEventType.inlineProcessingStarted, {
|
|
17
|
+
query
|
|
18
|
+
});
|
|
17
19
|
const queryBeingProcessed = queriesInProcessing.get(query.userId);
|
|
18
20
|
if (queryBeingProcessed) {
|
|
19
|
-
|
|
21
|
+
this.eventEmitter.emit(BotEventType.inlineProcessingAborting, {
|
|
22
|
+
newQuery: query,
|
|
23
|
+
abortedQuery: queryBeingProcessed
|
|
24
|
+
});
|
|
20
25
|
queryBeingProcessed.abortController.abort();
|
|
21
26
|
queriesInProcessing.delete(query.userId);
|
|
22
27
|
}
|
|
@@ -24,19 +29,23 @@ export class InlineQueryActionProcessor extends BaseActionProcessor {
|
|
|
24
29
|
pendingInlineQueries.push(query);
|
|
25
30
|
});
|
|
26
31
|
this.scheduler.createTask('InlineQueryProcessing', async () => {
|
|
27
|
-
const ctx = new InlineQueryContextInternal(this.storage, this.scheduler);
|
|
32
|
+
const ctx = new InlineQueryContextInternal(this.storage, this.scheduler, this.eventEmitter);
|
|
28
33
|
const queriesToProcess = [...pendingInlineQueries];
|
|
29
34
|
pendingInlineQueries = [];
|
|
30
35
|
for (const inlineQuery of queriesToProcess) {
|
|
31
36
|
queriesInProcessing.set(inlineQuery.userId, inlineQuery);
|
|
32
37
|
for (const inlineQueryAction of this.inlineQueries) {
|
|
33
38
|
this.initializeInlineQueryContext(ctx, inlineQuery.query, inlineQuery.queryId, inlineQueryAction, inlineQuery.abortController.signal, inlineQuery.traceId);
|
|
34
|
-
await this.executeAction(inlineQueryAction, ctx, (error,
|
|
39
|
+
await this.executeAction(inlineQueryAction, ctx, (error, _) => {
|
|
35
40
|
if (error.name == 'AbortError') {
|
|
36
|
-
|
|
41
|
+
this.eventEmitter.emit(BotEventType.inlineProcessingAborted, {
|
|
42
|
+
abortedQuery: inlineQuery
|
|
43
|
+
});
|
|
37
44
|
}
|
|
38
45
|
else {
|
|
39
|
-
|
|
46
|
+
this.eventEmitter.emit(BotEventType.error, {
|
|
47
|
+
error
|
|
48
|
+
});
|
|
40
49
|
}
|
|
41
50
|
});
|
|
42
51
|
}
|
|
@@ -56,6 +65,5 @@ export class InlineQueryActionProcessor extends BaseActionProcessor {
|
|
|
56
65
|
ctx.isInitialized = true;
|
|
57
66
|
ctx.queryResults = [];
|
|
58
67
|
ctx.matchResults = [];
|
|
59
|
-
ctx.logger = this.logger.createScope(this.botName, traceId, 'Unknown');
|
|
60
68
|
}
|
|
61
69
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ScheduledAction } from '../../entities/actions/scheduledAction';
|
|
2
2
|
import { IActionState } from '../../types/actionState';
|
|
3
|
-
import { ILogger } from '../../types/logger';
|
|
4
3
|
import { IScheduler } from '../../types/scheduler';
|
|
5
4
|
import { IStorageClient } from '../../types/storage';
|
|
6
5
|
import { Seconds } from '../../types/timeValues';
|
|
7
6
|
import { TelegramApiService } from '../telegramApi';
|
|
8
7
|
import { BaseActionProcessor } from './baseProcessor';
|
|
8
|
+
import { TypedEventEmitter } from '../../types/events';
|
|
9
9
|
export declare class ScheduledActionProcessor extends BaseActionProcessor {
|
|
10
10
|
private readonly chats;
|
|
11
11
|
private scheduled;
|
|
12
|
-
constructor(botName: string, chats: Record<string, number>, storage: IStorageClient, scheduler: IScheduler,
|
|
12
|
+
constructor(botName: string, chats: Record<string, number>, storage: IStorageClient, scheduler: IScheduler, eventEmitter: TypedEventEmitter);
|
|
13
13
|
initialize(api: TelegramApiService, scheduled: ScheduledAction<IActionState>[], period: Seconds): void;
|
|
14
14
|
private runScheduled;
|
|
15
15
|
private initializeChatContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduledActionProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/scheduledActionProcessor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAIzE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"scheduledActionProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/scheduledActionProcessor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAIzE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAgB,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,qBAAa,wBAAyB,SAAQ,mBAAmB;IAC7D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;IAE/C,OAAO,CAAC,SAAS,CAAmC;gBAGhD,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,UAAU,EACrB,YAAY,EAAE,iBAAiB;IAMnC,UAAU,CACN,GAAG,EAAE,kBAAkB,EACvB,SAAS,EAAE,eAAe,CAAC,YAAY,CAAC,EAAE,EAC1C,MAAM,EAAE,OAAO;YAkDL,YAAY;IA2B1B,OAAO,CAAC,qBAAqB;CAahC"}
|
|
@@ -7,8 +7,8 @@ import { BaseActionProcessor } from './baseProcessor';
|
|
|
7
7
|
export class ScheduledActionProcessor extends BaseActionProcessor {
|
|
8
8
|
chats;
|
|
9
9
|
scheduled;
|
|
10
|
-
constructor(botName, chats, storage, scheduler,
|
|
11
|
-
super(botName, storage, scheduler,
|
|
10
|
+
constructor(botName, chats, storage, scheduler, eventEmitter) {
|
|
11
|
+
super(botName, storage, scheduler, eventEmitter);
|
|
12
12
|
this.chats = chats;
|
|
13
13
|
}
|
|
14
14
|
initialize(api, scheduled, period) {
|
|
@@ -32,10 +32,11 @@ export class ScheduledActionProcessor extends BaseActionProcessor {
|
|
|
32
32
|
void this.runScheduled();
|
|
33
33
|
}, secondsToMilliseconds(period), true, this.botName);
|
|
34
34
|
}, delay, this.botName);
|
|
35
|
+
void this.runScheduled();
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
async runScheduled() {
|
|
38
|
-
const ctx = new ChatContextInternal(this.storage, this.scheduler);
|
|
39
|
+
const ctx = new ChatContextInternal(this.storage, this.scheduler, this.eventEmitter);
|
|
39
40
|
for (const [chatName, chatId] of Object.entries(this.chats)) {
|
|
40
41
|
for (const scheduledAction of this.scheduled) {
|
|
41
42
|
this.initializeChatContext(ctx, scheduledAction, new ChatInfo(chatId, chatName, []), createTrace(scheduledAction, this.botName, `${scheduledAction.key}-${chatId}`));
|
|
@@ -51,6 +52,5 @@ export class ScheduledActionProcessor extends BaseActionProcessor {
|
|
|
51
52
|
ctx.action = action;
|
|
52
53
|
ctx.chatInfo = chatInfo;
|
|
53
54
|
ctx.traceId = traceId;
|
|
54
|
-
ctx.logger = this.logger.createScope(this.botName, traceId, chatInfo.name);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { IStorageClient } from '../types/storage';
|
|
2
2
|
import { IActionState } from '../types/actionState';
|
|
3
3
|
import { IActionWithState, ActionKey } from '../types/action';
|
|
4
|
+
import { TypedEventEmitter } from '../types/events';
|
|
4
5
|
export declare class JsonFileStorage implements IStorageClient {
|
|
6
|
+
private readonly eventEmitter;
|
|
5
7
|
private readonly filePaths;
|
|
6
8
|
private readonly locks;
|
|
7
9
|
private readonly cache;
|
|
8
10
|
private readonly storagePath;
|
|
9
11
|
private readonly botName;
|
|
10
|
-
constructor(botName: string, actions: IActionWithState<IActionState>[], path?: string);
|
|
12
|
+
constructor(botName: string, actions: IActionWithState<IActionState>[], eventEmitter: TypedEventEmitter, path?: string);
|
|
11
13
|
private backfillEmptyActionStates;
|
|
12
14
|
private lock;
|
|
13
15
|
private tryGetFromCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonFileStorage.d.ts","sourceRoot":"","sources":["../../services/jsonFileStorage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"jsonFileStorage.d.ts","sourceRoot":"","sources":["../../services/jsonFileStorage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAAgB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAMlE,qBAAa,eAAgB,YAAW,cAAc;IAClD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IACjD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgC;IAC1D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4C;IAClE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAG7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAAE,EACzC,YAAY,EAAE,iBAAiB,EAC/B,IAAI,CAAC,EAAE,MAAM;IAsBjB,OAAO,CAAC,yBAAyB;YAanB,IAAI;IAelB,OAAO,CAAC,eAAe;YAIT,YAAY;YA6BZ,wBAAwB;IAuBhC,IAAI,CAAC,YAAY,SAAS,YAAY,EAAE,GAAG,EAAE,SAAS;IAStD,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAAE;IAQtD,cAAc,CAAC,YAAY,SAAS,YAAY,EAClD,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACtC,MAAM,EAAE,MAAM;IAsBZ,yBAAyB,CAAC,YAAY,SAAS,YAAY,EAC7D,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACtC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,YAAY;IAcjB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAMtB,cAAc,CAAC,YAAY,SAAS,YAAY,EAClD,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACtC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;CAkB5D"}
|
|
@@ -2,16 +2,19 @@ import { existsSync, mkdirSync } from 'fs';
|
|
|
2
2
|
import { readFile, writeFile } from 'fs/promises';
|
|
3
3
|
import { Sema as Semaphore } from 'async-sema';
|
|
4
4
|
import { getOrSetIfNotExists } from '../helpers/mapUtils';
|
|
5
|
+
import { BotEventType } from '../types/events';
|
|
5
6
|
function buildPath(storagePath, botName, actionKey) {
|
|
6
7
|
return `${storagePath}/${botName}/${actionKey.replaceAll(':', '/')}.json`;
|
|
7
8
|
}
|
|
8
9
|
export class JsonFileStorage {
|
|
10
|
+
eventEmitter;
|
|
9
11
|
filePaths = new Map();
|
|
10
12
|
locks = new Map();
|
|
11
13
|
cache;
|
|
12
14
|
storagePath;
|
|
13
15
|
botName;
|
|
14
|
-
constructor(botName, actions, path) {
|
|
16
|
+
constructor(botName, actions, eventEmitter, path) {
|
|
17
|
+
this.eventEmitter = eventEmitter;
|
|
15
18
|
this.cache = new Map();
|
|
16
19
|
this.botName = botName;
|
|
17
20
|
this.storagePath = path ?? 'storage';
|
|
@@ -35,12 +38,15 @@ export class JsonFileStorage {
|
|
|
35
38
|
}
|
|
36
39
|
async lock(key, action) {
|
|
37
40
|
const lock = getOrSetIfNotExists(this.locks, key, new Semaphore(1));
|
|
41
|
+
this.eventEmitter.emit(BotEventType.storageLockAcquiring, key);
|
|
38
42
|
await lock.acquire();
|
|
43
|
+
this.eventEmitter.emit(BotEventType.storageLockAcquired, key);
|
|
39
44
|
try {
|
|
40
45
|
return await action();
|
|
41
46
|
}
|
|
42
47
|
finally {
|
|
43
48
|
lock.release();
|
|
49
|
+
this.eventEmitter.emit(BotEventType.storageLockReleased, key);
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
tryGetFromCache(key) {
|
|
@@ -59,9 +65,17 @@ export class JsonFileStorage {
|
|
|
59
65
|
return (this.cache.get(key) ?? {});
|
|
60
66
|
}
|
|
61
67
|
async updateCacheAndSaveToFile(data, key) {
|
|
68
|
+
this.eventEmitter.emit(BotEventType.storageStateSaving, {
|
|
69
|
+
data,
|
|
70
|
+
key
|
|
71
|
+
});
|
|
62
72
|
this.cache.set(key, data);
|
|
63
73
|
const targetPath = getOrSetIfNotExists(this.filePaths, key, buildPath(this.storagePath, this.botName, key));
|
|
64
74
|
await writeFile(targetPath, JSON.stringify(data), { flag: 'w+' });
|
|
75
|
+
this.eventEmitter.emit(BotEventType.storageStateSaved, {
|
|
76
|
+
data,
|
|
77
|
+
key
|
|
78
|
+
});
|
|
65
79
|
}
|
|
66
80
|
async load(key) {
|
|
67
81
|
return (this.tryGetFromCache(key) ??
|
|
@@ -76,11 +90,21 @@ export class JsonFileStorage {
|
|
|
76
90
|
});
|
|
77
91
|
}
|
|
78
92
|
async getActionState(action, chatId) {
|
|
93
|
+
this.eventEmitter.emit(BotEventType.storageStateLoading, {
|
|
94
|
+
action,
|
|
95
|
+
chatId
|
|
96
|
+
});
|
|
79
97
|
const value = this.tryGetFromCache(action.key) ??
|
|
80
98
|
(await this.lock(action.key, async () => {
|
|
81
99
|
return await this.loadFromFile(action.key);
|
|
82
100
|
}));
|
|
83
|
-
|
|
101
|
+
const result = Object.assign(action.stateConstructor(), value[chatId]);
|
|
102
|
+
this.eventEmitter.emit(BotEventType.storageStateLoaded, {
|
|
103
|
+
action,
|
|
104
|
+
chatId,
|
|
105
|
+
state: result
|
|
106
|
+
});
|
|
107
|
+
return result;
|
|
84
108
|
}
|
|
85
109
|
async saveActionExecutionResult(action, chatId, state) {
|
|
86
110
|
await this.lock(action.key, async () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { TaskRecord } from '../entities/taskRecord';
|
|
2
|
-
import {
|
|
2
|
+
import { TypedEventEmitter } from '../types/events';
|
|
3
3
|
import { IScheduler } from '../types/scheduler';
|
|
4
4
|
import { Milliseconds } from '../types/timeValues';
|
|
5
5
|
export declare class NodeTimeoutScheduler implements IScheduler {
|
|
6
|
-
|
|
6
|
+
readonly eventEmitter: TypedEventEmitter;
|
|
7
7
|
readonly activeTasks: TaskRecord[];
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(eventEmitter: TypedEventEmitter);
|
|
9
9
|
stopAll(): void;
|
|
10
10
|
createTask(name: string, action: () => unknown, interval: Milliseconds, executeRightAway: boolean, ownerName: string): void;
|
|
11
11
|
createOnetimeTask(name: string, action: () => unknown, delay: Milliseconds, ownerName: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeTimeoutScheduler.d.ts","sourceRoot":"","sources":["../../services/nodeTimeoutScheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"nodeTimeoutScheduler.d.ts","sourceRoot":"","sources":["../../services/nodeTimeoutScheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,qBAAa,oBAAqB,YAAW,UAAU;IAGvC,QAAQ,CAAC,YAAY,EAAE,iBAAiB;IAFpD,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAM;gBAEnB,YAAY,EAAE,iBAAiB;IAEpD,OAAO;IAMP,UAAU,CACN,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,OAAO,EACrB,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,OAAO,EACzB,SAAS,EAAE,MAAM;IAyBrB,iBAAiB,CACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,OAAO,EACrB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM;CAkBxB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TaskRecord } from '../entities/taskRecord';
|
|
2
|
-
import {
|
|
2
|
+
import { BotEventType } from '../types/events';
|
|
3
3
|
export class NodeTimeoutScheduler {
|
|
4
|
-
|
|
4
|
+
eventEmitter;
|
|
5
5
|
activeTasks = [];
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
6
|
+
constructor(eventEmitter) {
|
|
7
|
+
this.eventEmitter = eventEmitter;
|
|
8
8
|
}
|
|
9
9
|
stopAll() {
|
|
10
10
|
for (const task of this.activeTasks) {
|
|
@@ -12,20 +12,39 @@ export class NodeTimeoutScheduler {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
createTask(name, action, interval, executeRightAway, ownerName) {
|
|
15
|
-
const taskId = setInterval(
|
|
15
|
+
const taskId = setInterval(() => {
|
|
16
|
+
action();
|
|
17
|
+
this.eventEmitter.emit(BotEventType.taskRun, {
|
|
18
|
+
name,
|
|
19
|
+
ownerName,
|
|
20
|
+
interval
|
|
21
|
+
});
|
|
22
|
+
}, interval);
|
|
16
23
|
const task = new TaskRecord(name, taskId, interval);
|
|
17
24
|
if (executeRightAway) {
|
|
18
25
|
setImmediate(action);
|
|
19
26
|
}
|
|
20
|
-
this.
|
|
27
|
+
this.eventEmitter.emit(BotEventType.taskCreated, {
|
|
28
|
+
name,
|
|
29
|
+
ownerName,
|
|
30
|
+
interval
|
|
31
|
+
});
|
|
21
32
|
this.activeTasks.push(task);
|
|
22
33
|
}
|
|
23
34
|
createOnetimeTask(name, action, delay, ownerName) {
|
|
24
35
|
const actionWrapper = () => {
|
|
25
|
-
this.
|
|
36
|
+
this.eventEmitter.emit(BotEventType.taskRun, {
|
|
37
|
+
name,
|
|
38
|
+
ownerName,
|
|
39
|
+
delay
|
|
40
|
+
});
|
|
26
41
|
action();
|
|
27
42
|
};
|
|
28
43
|
setTimeout(actionWrapper, delay);
|
|
29
|
-
this.
|
|
44
|
+
this.eventEmitter.emit(BotEventType.taskCreated, {
|
|
45
|
+
name,
|
|
46
|
+
ownerName,
|
|
47
|
+
delay
|
|
48
|
+
});
|
|
30
49
|
}
|
|
31
50
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { IStorageClient } from '../types/storage';
|
|
2
2
|
import { BotResponse } from '../types/response';
|
|
3
|
-
import { ILogger } from '../types/logger';
|
|
4
3
|
import { IReplyCapture } from '../types/capture';
|
|
5
|
-
import { TraceId } from '../types/trace';
|
|
6
4
|
import { ChatInfo } from '../dtos/chatInfo';
|
|
7
5
|
import { TelegramApiClient } from '../types/externalAliases';
|
|
6
|
+
import { TypedEventEmitter } from '../types/events';
|
|
8
7
|
export declare const TELEGRAM_ERROR_QUOTE_INVALID = "QUOTE_TEXT_INVALID";
|
|
9
8
|
export declare class TelegramApiService {
|
|
10
9
|
private readonly queue;
|
|
11
10
|
private readonly telegram;
|
|
12
11
|
private readonly storage;
|
|
13
|
-
private readonly
|
|
12
|
+
private readonly eventEmitter;
|
|
14
13
|
private readonly captureRegistrationCallback;
|
|
15
14
|
private readonly botName;
|
|
16
|
-
|
|
15
|
+
private readonly methodMap;
|
|
16
|
+
constructor(botName: string, telegram: TelegramApiClient, storage: IStorageClient, eventEmitter: TypedEventEmitter, captureRegistrationCallback: (capture: IReplyCapture, parentMessageId: number, chatInfo: ChatInfo) => void);
|
|
17
17
|
enqueueBatchedResponses(responses: BotResponse[]): void;
|
|
18
18
|
flushResponses(): void;
|
|
19
19
|
private pinIfShould;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegramApi.d.ts","sourceRoot":"","sources":["../../services/telegramApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"telegramApi.d.ts","sourceRoot":"","sources":["../../services/telegramApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACH,WAAW,EAGd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAmB,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAgB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAElE,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AAEjE,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IACjD,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAKlC;IAEV,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAYxB;gBAGE,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,iBAAiB,EAC/B,2BAA2B,EAAE,CACzB,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,KACjB,IAAI;IASb,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE;IAoDhD,cAAc;YAIA,WAAW;YA6BX,eAAe;YAqBf,cAAc;CAkG/B"}
|