chz-telegram-bot 0.5.3 → 0.5.5
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/dist/builtin/helpAction.d.ts +2 -0
- package/dist/builtin/helpAction.d.ts.map +1 -0
- package/dist/builtin/helpAction.js +14 -0
- package/dist/dtos/chatHistoryMessage.d.ts +35 -0
- package/dist/dtos/chatHistoryMessage.d.ts.map +1 -0
- package/dist/dtos/chatHistoryMessage.js +32 -0
- package/dist/dtos/chatInfo.d.ts +17 -0
- package/dist/dtos/chatInfo.d.ts.map +1 -0
- package/dist/dtos/chatInfo.js +16 -0
- package/dist/dtos/commandTriggerCheckResult.d.ts +24 -0
- package/dist/dtos/commandTriggerCheckResult.d.ts.map +1 -0
- package/dist/dtos/commandTriggerCheckResult.js +34 -0
- package/dist/dtos/cooldownInfo.d.ts +13 -0
- package/dist/dtos/cooldownInfo.d.ts.map +1 -0
- package/dist/dtos/cooldownInfo.js +12 -0
- package/dist/dtos/incomingMessage.d.ts +19 -0
- package/dist/dtos/incomingMessage.d.ts.map +1 -0
- package/dist/dtos/incomingMessage.js +63 -0
- package/dist/dtos/incomingQuery.d.ts +10 -0
- package/dist/dtos/incomingQuery.d.ts.map +1 -0
- package/dist/dtos/incomingQuery.js +14 -0
- package/dist/dtos/messageInfo.d.ts +22 -0
- package/dist/dtos/messageInfo.d.ts.map +1 -0
- package/dist/dtos/messageInfo.js +20 -0
- package/dist/dtos/propertyProviderSets.d.ts +16 -0
- package/dist/dtos/propertyProviderSets.d.ts.map +1 -0
- package/dist/dtos/propertyProviderSets.js +1 -0
- package/dist/dtos/replyInfo.d.ts +6 -0
- package/dist/dtos/replyInfo.d.ts.map +1 -0
- package/dist/dtos/replyInfo.js +8 -0
- package/dist/dtos/responses/delay.d.ts +16 -0
- package/dist/dtos/responses/delay.d.ts.map +1 -0
- package/dist/dtos/responses/delay.js +15 -0
- package/dist/dtos/responses/imageMessage.d.ts +22 -0
- package/dist/dtos/responses/imageMessage.d.ts.map +1 -0
- package/dist/dtos/responses/imageMessage.js +21 -0
- package/dist/dtos/responses/inlineQueryResponse.d.ts +13 -0
- package/dist/dtos/responses/inlineQueryResponse.d.ts.map +1 -0
- package/dist/dtos/responses/inlineQueryResponse.js +15 -0
- package/dist/dtos/responses/reaction.d.ts +16 -0
- package/dist/dtos/responses/reaction.d.ts.map +1 -0
- package/dist/dtos/responses/reaction.js +17 -0
- package/dist/dtos/responses/textMessage.d.ts +23 -0
- package/dist/dtos/responses/textMessage.d.ts.map +1 -0
- package/dist/dtos/responses/textMessage.js +24 -0
- package/dist/dtos/responses/unpin.d.ts +15 -0
- package/dist/dtos/responses/unpin.d.ts.map +1 -0
- package/dist/dtos/responses/unpin.js +15 -0
- package/dist/dtos/responses/videoMessage.d.ts +22 -0
- package/dist/dtos/responses/videoMessage.d.ts.map +1 -0
- package/dist/dtos/responses/videoMessage.js +21 -0
- package/dist/dtos/userInfo.d.ts +12 -0
- package/dist/dtos/userInfo.d.ts.map +1 -0
- package/dist/dtos/userInfo.js +12 -0
- package/dist/entities/actions/commandAction.d.ts +31 -0
- package/dist/entities/actions/commandAction.d.ts.map +1 -0
- package/dist/entities/actions/commandAction.js +139 -0
- package/dist/entities/actions/inlineQueryAction.d.ts +14 -0
- package/dist/entities/actions/inlineQueryAction.d.ts.map +1 -0
- package/dist/entities/actions/inlineQueryAction.js +43 -0
- package/dist/entities/actions/replyCaptureAction.d.ts +15 -0
- package/dist/entities/actions/replyCaptureAction.d.ts.map +1 -0
- package/dist/entities/actions/replyCaptureAction.js +58 -0
- package/dist/entities/actions/scheduledAction.d.ts +24 -0
- package/dist/entities/actions/scheduledAction.d.ts.map +1 -0
- package/dist/entities/actions/scheduledAction.js +72 -0
- package/dist/entities/botInstance.d.ts +37 -0
- package/dist/entities/botInstance.d.ts.map +1 -0
- package/dist/entities/botInstance.js +37 -0
- package/dist/entities/cachedStateFactory.d.ts +7 -0
- package/dist/entities/cachedStateFactory.d.ts.map +1 -0
- package/dist/entities/cachedStateFactory.js +8 -0
- package/dist/entities/context/baseContext.d.ts +39 -0
- package/dist/entities/context/baseContext.d.ts.map +1 -0
- package/dist/entities/context/baseContext.js +55 -0
- package/dist/entities/context/chatContext.d.ts +50 -0
- package/dist/entities/context/chatContext.d.ts.map +1 -0
- package/dist/entities/context/chatContext.js +65 -0
- package/dist/entities/context/inlineQueryContext.d.ts +27 -0
- package/dist/entities/context/inlineQueryContext.d.ts.map +1 -0
- package/dist/entities/context/inlineQueryContext.js +29 -0
- package/dist/entities/context/messageContext.d.ts +92 -0
- package/dist/entities/context/messageContext.d.ts.map +1 -0
- package/dist/entities/context/messageContext.js +116 -0
- package/dist/entities/context/replyContext.d.ts +89 -0
- package/dist/entities/context/replyContext.d.ts.map +1 -0
- package/dist/entities/context/replyContext.js +124 -0
- package/dist/entities/states/actionStateBase.d.ts +6 -0
- package/dist/entities/states/actionStateBase.d.ts.map +1 -0
- package/dist/entities/states/actionStateBase.js +4 -0
- package/dist/entities/taskRecord.d.ts +8 -0
- package/dist/entities/taskRecord.d.ts.map +1 -0
- package/dist/entities/taskRecord.js +10 -0
- package/dist/eslint.config.d.ts +3 -0
- package/dist/eslint.config.d.ts.map +1 -0
- package/dist/eslint.config.js +51 -0
- package/dist/helpers/builders/commandActionBuilder.d.ts +100 -0
- package/dist/helpers/builders/commandActionBuilder.d.ts.map +1 -0
- package/dist/helpers/builders/commandActionBuilder.js +146 -0
- package/dist/helpers/builders/inlineQueryActionBuilder.d.ts +37 -0
- package/dist/helpers/builders/inlineQueryActionBuilder.d.ts.map +1 -0
- package/dist/helpers/builders/inlineQueryActionBuilder.js +50 -0
- package/dist/helpers/builders/scheduledActionBuilder.d.ts +68 -0
- package/dist/helpers/builders/scheduledActionBuilder.d.ts.map +1 -0
- package/dist/helpers/builders/scheduledActionBuilder.js +95 -0
- package/dist/helpers/mapUtils.d.ts +10 -0
- package/dist/helpers/mapUtils.d.ts.map +1 -0
- package/dist/helpers/mapUtils.js +13 -0
- package/dist/helpers/noop.d.ts +9 -0
- package/dist/helpers/noop.d.ts.map +1 -0
- package/dist/helpers/noop.js +17 -0
- package/dist/helpers/objectFromEntries.d.ts +2 -0
- package/dist/helpers/objectFromEntries.d.ts.map +1 -0
- package/dist/helpers/objectFromEntries.js +3 -0
- package/dist/helpers/timeConvertions.d.ts +5 -0
- package/dist/helpers/timeConvertions.d.ts.map +1 -0
- package/dist/helpers/timeConvertions.js +9 -0
- package/dist/helpers/toArray.d.ts +2 -0
- package/dist/helpers/toArray.d.ts.map +1 -0
- package/dist/helpers/toArray.js +3 -0
- package/dist/helpers/traceFactory.d.ts +3 -0
- package/dist/helpers/traceFactory.d.ts.map +1 -0
- package/dist/helpers/traceFactory.js +3 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/main.d.ts +52 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +34 -0
- package/dist/services/actionProcessingService.d.ts +25 -0
- package/dist/services/actionProcessingService.d.ts.map +1 -0
- package/dist/services/actionProcessingService.js +50 -0
- package/dist/services/actionProcessors/baseProcessor.d.ts +18 -0
- package/dist/services/actionProcessors/baseProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/baseProcessor.js +29 -0
- package/dist/services/actionProcessors/commandActionProcessor.d.ts +20 -0
- package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/commandActionProcessor.js +116 -0
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts +11 -0
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/inlineQueryActionProcessor.js +61 -0
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts +17 -0
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/scheduledActionProcessor.js +56 -0
- package/dist/services/jsonFileStorage.d.ts +23 -0
- package/dist/services/jsonFileStorage.d.ts.map +1 -0
- package/dist/services/jsonFileStorage.js +109 -0
- package/dist/services/jsonLogger.d.ts +11 -0
- package/dist/services/jsonLogger.d.ts.map +1 -0
- package/dist/services/jsonLogger.js +66 -0
- package/dist/services/nodeTimeoutScheduler.d.ts +13 -0
- package/dist/services/nodeTimeoutScheduler.d.ts.map +1 -0
- package/dist/services/nodeTimeoutScheduler.js +31 -0
- package/dist/services/responseProcessingQueue.d.ts +12 -0
- package/dist/services/responseProcessingQueue.d.ts.map +1 -0
- package/dist/services/responseProcessingQueue.js +37 -0
- package/dist/services/telegramApi.d.ts +23 -0
- package/dist/services/telegramApi.d.ts.map +1 -0
- package/dist/services/telegramApi.js +133 -0
- package/dist/types/action.d.ts +14 -0
- package/dist/types/action.d.ts.map +1 -0
- package/dist/types/action.js +1 -0
- package/dist/types/actionState.d.ts +5 -0
- package/dist/types/actionState.d.ts.map +1 -0
- package/dist/types/actionState.js +1 -0
- package/dist/types/cachedValueAccessor.d.ts +2 -0
- package/dist/types/cachedValueAccessor.d.ts.map +1 -0
- package/dist/types/cachedValueAccessor.js +1 -0
- package/dist/types/capture.d.ts +24 -0
- package/dist/types/capture.d.ts.map +1 -0
- package/dist/types/capture.js +1 -0
- package/dist/types/commandCondition.d.ts +8 -0
- package/dist/types/commandCondition.d.ts.map +1 -0
- package/dist/types/commandCondition.js +1 -0
- package/dist/types/commandTrigger.d.ts +2 -0
- package/dist/types/commandTrigger.d.ts.map +1 -0
- package/dist/types/commandTrigger.js +1 -0
- package/dist/types/externalAliases.d.ts +11 -0
- package/dist/types/externalAliases.d.ts.map +1 -0
- package/dist/types/externalAliases.js +1 -0
- package/dist/types/handlers.d.ts +21 -0
- package/dist/types/handlers.d.ts.map +1 -0
- package/dist/types/handlers.js +1 -0
- package/dist/types/inputFile.d.ts +5 -0
- package/dist/types/inputFile.d.ts.map +1 -0
- package/dist/types/inputFile.js +1 -0
- package/dist/types/logger.d.ts +13 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/logger.js +1 -0
- package/dist/types/messageSendingOptions.d.ts +9 -0
- package/dist/types/messageSendingOptions.d.ts.map +1 -0
- package/dist/types/messageSendingOptions.js +1 -0
- package/dist/types/messageTypes.d.ts +20 -0
- package/dist/types/messageTypes.d.ts.map +1 -0
- package/dist/types/messageTypes.js +18 -0
- package/dist/types/propertyProvider.d.ts +8 -0
- package/dist/types/propertyProvider.d.ts.map +1 -0
- package/dist/types/propertyProvider.js +1 -0
- package/dist/types/response.d.ts +39 -0
- package/dist/types/response.d.ts.map +1 -0
- package/dist/types/response.js +9 -0
- package/dist/types/scheduler.d.ts +7 -0
- package/dist/types/scheduler.d.ts.map +1 -0
- package/dist/types/scheduler.js +1 -0
- package/dist/types/storage.d.ts +11 -0
- package/dist/types/storage.d.ts.map +1 -0
- package/dist/types/storage.js +1 -0
- package/dist/types/timeValues.d.ts +15 -0
- package/dist/types/timeValues.d.ts.map +1 -0
- package/dist/types/timeValues.js +1 -0
- package/dist/types/trace.d.ts +6 -0
- package/dist/types/trace.d.ts.map +1 -0
- package/dist/types/trace.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ResponseProcessingQueue } from './responseProcessingQueue';
|
|
2
|
+
export const TELEGRAM_ERROR_QUOTE_INVALID = 'QUOTE_TEXT_INVALID';
|
|
3
|
+
export class TelegramApiService {
|
|
4
|
+
queue = new ResponseProcessingQueue();
|
|
5
|
+
telegram;
|
|
6
|
+
storage;
|
|
7
|
+
logger;
|
|
8
|
+
captureRegistrationCallback;
|
|
9
|
+
botName;
|
|
10
|
+
constructor(botName, telegram, storage, logger, captureRegistrationCallback) {
|
|
11
|
+
this.telegram = telegram;
|
|
12
|
+
this.botName = botName;
|
|
13
|
+
this.storage = storage;
|
|
14
|
+
this.logger = logger;
|
|
15
|
+
this.captureRegistrationCallback = captureRegistrationCallback;
|
|
16
|
+
}
|
|
17
|
+
enqueueBatchedResponses(responses) {
|
|
18
|
+
let offset = 0;
|
|
19
|
+
for (const response of responses) {
|
|
20
|
+
if (response.kind == 'delay') {
|
|
21
|
+
offset += response.delay;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const queueItem = {
|
|
25
|
+
callback: async () => {
|
|
26
|
+
const scopedLogger = this.logger.createScope(this.botName, response.traceId, 'chatInfo' in response
|
|
27
|
+
? response.chatInfo.name
|
|
28
|
+
: 'Unknown');
|
|
29
|
+
try {
|
|
30
|
+
await this.processResponse(response);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if ('message' in error) {
|
|
34
|
+
const telegramResponse = error;
|
|
35
|
+
if (telegramResponse.message.includes(TELEGRAM_ERROR_QUOTE_INVALID)) {
|
|
36
|
+
scopedLogger.logWithTraceId('Quote error recieved, retrying without quote');
|
|
37
|
+
try {
|
|
38
|
+
await this.processResponse(response, true);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
scopedLogger.errorWithTraceId(error, response);
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
scopedLogger.errorWithTraceId(error, response);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
priority: response.createdAt + offset
|
|
50
|
+
};
|
|
51
|
+
this.queue.enqueue(queueItem);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
flushResponses() {
|
|
55
|
+
void this.queue.flushReadyItems();
|
|
56
|
+
}
|
|
57
|
+
async pinIfShould(response, message) {
|
|
58
|
+
if (response.shouldPin) {
|
|
59
|
+
await this.telegram.pinChatMessage(response.chatInfo.id, message.message_id, { disable_notification: true });
|
|
60
|
+
await this.storage.updateStateFor(response.action, response.chatInfo.id, (state) => {
|
|
61
|
+
state.pinnedMessages.push(message.message_id);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async processResponse(response, ignoreQuote = false) {
|
|
66
|
+
const sentMessage = await this.sendApiRequest(response, ignoreQuote);
|
|
67
|
+
if (sentMessage && 'content' in response) {
|
|
68
|
+
await this.pinIfShould(response, sentMessage);
|
|
69
|
+
for (const capture of response.captures) {
|
|
70
|
+
this.captureRegistrationCallback(capture, sentMessage.message_id, response.chatInfo, response.traceId);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async sendApiRequest(response, ignoreQuote) {
|
|
75
|
+
switch (response.kind) {
|
|
76
|
+
case 'text':
|
|
77
|
+
return await this.telegram.sendMessage(response.chatInfo.id, response.content, {
|
|
78
|
+
reply_parameters: response.replyInfo
|
|
79
|
+
? {
|
|
80
|
+
message_id: response.replyInfo.id,
|
|
81
|
+
quote: ignoreQuote
|
|
82
|
+
? undefined
|
|
83
|
+
: response.replyInfo.quote
|
|
84
|
+
}
|
|
85
|
+
: undefined,
|
|
86
|
+
parse_mode: 'MarkdownV2',
|
|
87
|
+
link_preview_options: {
|
|
88
|
+
is_disabled: response.disableWebPreview
|
|
89
|
+
},
|
|
90
|
+
reply_markup: response.keyboard
|
|
91
|
+
? {
|
|
92
|
+
inline_keyboard: response.keyboard
|
|
93
|
+
}
|
|
94
|
+
: undefined
|
|
95
|
+
});
|
|
96
|
+
case 'image':
|
|
97
|
+
return await this.telegram.sendPhoto(response.chatInfo.id, response.content,
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
99
|
+
response.replyInfo?.id
|
|
100
|
+
? {
|
|
101
|
+
reply_to_message_id: response.replyInfo.id // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
+
}
|
|
103
|
+
: undefined);
|
|
104
|
+
case 'video':
|
|
105
|
+
return await this.telegram.sendVideo(response.chatInfo.id, response.content,
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
107
|
+
response.replyInfo?.id
|
|
108
|
+
? {
|
|
109
|
+
reply_to_message_id: response.replyInfo.id // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
+
}
|
|
111
|
+
: undefined);
|
|
112
|
+
case 'react':
|
|
113
|
+
await this.telegram.setMessageReaction(response.chatInfo.id, response.messageId, [
|
|
114
|
+
{
|
|
115
|
+
type: 'emoji',
|
|
116
|
+
emoji: response.emoji
|
|
117
|
+
}
|
|
118
|
+
]);
|
|
119
|
+
return null;
|
|
120
|
+
case 'unpin':
|
|
121
|
+
await this.telegram.unpinChatMessage(response.chatInfo.id, response.messageId);
|
|
122
|
+
await this.storage.updateStateFor(response.action, response.chatInfo.id, (state) => {
|
|
123
|
+
state.pinnedMessages = state.pinnedMessages.filter((x) => x != response.messageId);
|
|
124
|
+
});
|
|
125
|
+
return null;
|
|
126
|
+
case 'inlineQuery':
|
|
127
|
+
await this.telegram.answerInlineQuery(response.queryId, response.queryResults, { cache_time: 0 });
|
|
128
|
+
return null;
|
|
129
|
+
case 'delay':
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseContextInternal } from '../entities/context/baseContext';
|
|
2
|
+
import { IActionState } from './actionState';
|
|
3
|
+
import { BotResponse } from './response';
|
|
4
|
+
export type ActionKey = string & {
|
|
5
|
+
__brand: 'actionKey';
|
|
6
|
+
};
|
|
7
|
+
export interface IActionWithState<TActionState extends IActionState> extends IAction {
|
|
8
|
+
readonly stateConstructor: () => TActionState;
|
|
9
|
+
}
|
|
10
|
+
export interface IAction {
|
|
11
|
+
readonly key: ActionKey;
|
|
12
|
+
exec(ctx: BaseContextInternal<IAction>): Promise<BotResponse[]>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../types/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC;AAE1D,MAAM,WAAW,gBAAgB,CAAC,YAAY,SAAS,YAAY,CAC/D,SAAQ,OAAO;IACf,QAAQ,CAAC,gBAAgB,EAAE,MAAM,YAAY,CAAC;CACjD;AAED,MAAM,WAAW,OAAO;IACpB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;CACnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionState.d.ts","sourceRoot":"","sources":["../../types/actionState.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cachedValueAccessor.d.ts","sourceRoot":"","sources":["../../types/cachedValueAccessor.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReplyContext, ReplyContextInternal } from '../entities/context/replyContext';
|
|
2
|
+
import { IActionState } from './actionState';
|
|
3
|
+
import { CommandTrigger } from './commandTrigger';
|
|
4
|
+
import { IAction } from './action';
|
|
5
|
+
export interface ICaptureController {
|
|
6
|
+
captureReplies: <TParentActionState extends IActionState>(
|
|
7
|
+
/**
|
|
8
|
+
* Defines action trigger.
|
|
9
|
+
* If `string` or `string[]` is provided, will be triggered only on exact message match.
|
|
10
|
+
* If `RegExp` or `RegExp[]` is provided, will be triggered on successful match.
|
|
11
|
+
*/
|
|
12
|
+
trigger: CommandTrigger[],
|
|
13
|
+
/** Callback that will be called on trigger */
|
|
14
|
+
handler: (replyContext: ReplyContext<TParentActionState>) => Promise<void>,
|
|
15
|
+
/** Abort controller to abort capturing manually */
|
|
16
|
+
abortController?: AbortController) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface IReplyCapture {
|
|
19
|
+
trigger: CommandTrigger[];
|
|
20
|
+
handler: (replyContext: ReplyContextInternal<IActionState>) => Promise<void>;
|
|
21
|
+
abortController: AbortController;
|
|
22
|
+
action: IAction;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../types/capture.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,oBAAoB,EACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,WAAW,kBAAkB;IAC/B,cAAc,EAAE,CAAC,kBAAkB,SAAS,YAAY;IACpD;;;;OAIG;IACH,OAAO,EAAE,cAAc,EAAE;IACzB,8CAA8C;IAC9C,OAAO,EAAE,CACL,YAAY,EAAE,YAAY,CAAC,kBAAkB,CAAC,KAC7C,OAAO,CAAC,IAAI,CAAC;IAClB,mDAAmD;IACnD,eAAe,CAAC,EAAE,eAAe,KAChC,IAAI,CAAC;CACb;AAED,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,OAAO,EAAE,CACL,YAAY,EAAE,oBAAoB,CAAC,YAAY,CAAC,KAC/C,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;IACjC,MAAM,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MessageContext } from '../entities/context/messageContext';
|
|
2
|
+
import { IActionState } from './actionState';
|
|
3
|
+
export type CommandCondition<TActionState extends IActionState> = (
|
|
4
|
+
/** Context of action executed in chat, in response to a message. */
|
|
5
|
+
ctx: MessageContext<TActionState>,
|
|
6
|
+
/** State of an action being executed. */
|
|
7
|
+
state: TActionState) => boolean;
|
|
8
|
+
//# sourceMappingURL=commandCondition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandCondition.d.ts","sourceRoot":"","sources":["../../types/commandCondition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,MAAM,gBAAgB,CAAC,YAAY,SAAS,YAAY,IAAI;AAC9D,oEAAoE;AACpE,GAAG,EAAE,cAAc,CAAC,YAAY,CAAC;AACjC,yCAAyC;AACzC,KAAK,EAAE,YAAY,KAClB,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandTrigger.d.ts","sourceRoot":"","sources":["../../types/commandTrigger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Telegram, Telegraf } from 'telegraf';
|
|
2
|
+
import { User, Message, InlineQueryResult, UserFromGetMe, TelegramEmoji as Emoji, InlineKeyboardButton } from 'telegraf/types';
|
|
3
|
+
export type TelegramUser = User;
|
|
4
|
+
export type TelegramMessage = Message;
|
|
5
|
+
export type TelegramInlineQueryResult = InlineQueryResult;
|
|
6
|
+
export type TelegramEmoji = Emoji;
|
|
7
|
+
export type TelegramApiClient = Telegram;
|
|
8
|
+
export type BotInfo = UserFromGetMe;
|
|
9
|
+
export type TelegramBot = Telegraf;
|
|
10
|
+
export type TelegramInlineKeyboardButton = InlineKeyboardButton;
|
|
11
|
+
//# sourceMappingURL=externalAliases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalAliases.d.ts","sourceRoot":"","sources":["../../types/externalAliases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACH,IAAI,EACJ,OAAO,EACP,iBAAiB,EACjB,aAAa,EACb,aAAa,IAAI,KAAK,EACtB,oBAAoB,EACvB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC;AAChC,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC;AACtC,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC1D,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC;AAClC,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AACzC,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AACnC,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChatContext } from '../entities/context/chatContext';
|
|
2
|
+
import { InlineQueryContext } from '../entities/context/inlineQueryContext';
|
|
3
|
+
import { MessageContext } from '../entities/context/messageContext';
|
|
4
|
+
import { IActionState } from './actionState';
|
|
5
|
+
import { CachedValueAccessor } from './cachedValueAccessor';
|
|
6
|
+
export type InlineQueryHandler = (
|
|
7
|
+
/** Context of inline query executed in chat, in response to a message. */
|
|
8
|
+
ctx: InlineQueryContext) => Promise<void>;
|
|
9
|
+
export type CommandHandler<TActionState extends IActionState> = (
|
|
10
|
+
/** Context of action executed in chat, in response to a message. */
|
|
11
|
+
ctx: MessageContext<TActionState>,
|
|
12
|
+
/** State of an action being executed. */
|
|
13
|
+
state: TActionState) => Promise<void> | void;
|
|
14
|
+
export type ScheduledHandler<TActionState extends IActionState> = (
|
|
15
|
+
/** Context of action executed in chat. */
|
|
16
|
+
ctx: ChatContext<TActionState>,
|
|
17
|
+
/** Function that will attempt to get value from cache. If there is no value found, corresponding cached state factory will be called. */
|
|
18
|
+
getCached: CachedValueAccessor,
|
|
19
|
+
/** State of an action being executed. */
|
|
20
|
+
state: TActionState) => Promise<void>;
|
|
21
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../types/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG;AAC7B,0EAA0E;AAC1E,GAAG,EAAE,kBAAkB,KACtB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,MAAM,cAAc,CAAC,YAAY,SAAS,YAAY,IAAI;AAC5D,oEAAoE;AACpE,GAAG,EAAE,cAAc,CAAC,YAAY,CAAC;AACjC,yCAAyC;AACzC,KAAK,EAAE,YAAY,KAClB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE1B,MAAM,MAAM,gBAAgB,CAAC,YAAY,SAAS,YAAY,IAAI;AAC9D,0CAA0C;AAC1C,GAAG,EAAE,WAAW,CAAC,YAAY,CAAC;AAC9B,yIAAyI;AACzI,SAAS,EAAE,mBAAmB;AAC9B,yCAAyC;AACzC,KAAK,EAAE,YAAY,KAClB,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputFile.d.ts","sourceRoot":"","sources":["../../types/inputFile.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TraceId } from './trace';
|
|
2
|
+
export interface IScopedLogger {
|
|
3
|
+
logObjectWithTraceId(data: unknown): void;
|
|
4
|
+
logWithTraceId(text: string): void;
|
|
5
|
+
errorWithTraceId(errorObj: unknown, extraData?: unknown): void;
|
|
6
|
+
}
|
|
7
|
+
export interface ILogger {
|
|
8
|
+
createScope(botName: string, traceId: TraceId, chatName: string): IScopedLogger;
|
|
9
|
+
logObjectWithTraceId(botName: string, traceId: TraceId, chatName: string, data: unknown): void;
|
|
10
|
+
logWithTraceId(botName: string, traceId: TraceId, chatName: string, text: string): void;
|
|
11
|
+
errorWithTraceId(botName: string, traceId: TraceId, chatName: string, errorObj: unknown, extraData?: unknown): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../types/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,WAAW,aAAa;IAC1B,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAE1C,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,OAAO;IACpB,WAAW,CACP,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,GACjB,aAAa,CAAC;IAEjB,oBAAoB,CAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,GACd,IAAI,CAAC;IAER,cAAc,CACV,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACb,IAAI,CAAC;IAER,gBAAgB,CACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EACjB,SAAS,CAAC,EAAE,OAAO,GACpB,IAAI,CAAC;CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TelegramInlineKeyboardButton } from './externalAliases';
|
|
2
|
+
export interface MessageSendingOptions {
|
|
3
|
+
pin?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface TextMessageSendingOptions extends MessageSendingOptions {
|
|
6
|
+
disableWebPreview?: boolean;
|
|
7
|
+
keyboard?: TelegramInlineKeyboardButton[][];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=messageSendingOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageSendingOptions.d.ts","sourceRoot":"","sources":["../../types/messageSendingOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,WAAW,qBAAqB;IAClC,GAAG,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACpE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,4BAA4B,EAAE,EAAE,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const INTERNAL_MESSAGE_TYPE_PREFIX = "__msg:";
|
|
2
|
+
export declare const MessageType: {
|
|
3
|
+
readonly Any: "__msg:Any";
|
|
4
|
+
readonly Text: "__msg:Text";
|
|
5
|
+
readonly Sticker: "__msg:Sticker";
|
|
6
|
+
readonly Animation: "__msg:Animation";
|
|
7
|
+
readonly Document: "__msg:Document";
|
|
8
|
+
readonly Voice: "__msg:Voice";
|
|
9
|
+
readonly Audio: "__msg:Audio";
|
|
10
|
+
readonly LeftChatMember: "__msg:LeftChatMember";
|
|
11
|
+
readonly NewChatMember: "__msg:NewChatMember";
|
|
12
|
+
readonly Poll: "__msg:Poll";
|
|
13
|
+
readonly Location: "__msg:Location";
|
|
14
|
+
readonly Photo: "__msg:Photo";
|
|
15
|
+
readonly Forward: "__msg:Forward";
|
|
16
|
+
readonly Video: "__msg:Video";
|
|
17
|
+
readonly Unknown: "__msg:Unknown";
|
|
18
|
+
};
|
|
19
|
+
export type MessageTypeValue = (typeof MessageType)[keyof typeof MessageType];
|
|
20
|
+
//# sourceMappingURL=messageTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageTypes.d.ts","sourceRoot":"","sources":["../../types/messageTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,WAAW,CAAC;AAErD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const INTERNAL_MESSAGE_TYPE_PREFIX = `__msg:`;
|
|
2
|
+
export const MessageType = {
|
|
3
|
+
Any: `${INTERNAL_MESSAGE_TYPE_PREFIX}Any`,
|
|
4
|
+
Text: `${INTERNAL_MESSAGE_TYPE_PREFIX}Text`,
|
|
5
|
+
Sticker: `${INTERNAL_MESSAGE_TYPE_PREFIX}Sticker`,
|
|
6
|
+
Animation: `${INTERNAL_MESSAGE_TYPE_PREFIX}Animation`,
|
|
7
|
+
Document: `${INTERNAL_MESSAGE_TYPE_PREFIX}Document`,
|
|
8
|
+
Voice: `${INTERNAL_MESSAGE_TYPE_PREFIX}Voice`,
|
|
9
|
+
Audio: `${INTERNAL_MESSAGE_TYPE_PREFIX}Audio`,
|
|
10
|
+
LeftChatMember: `${INTERNAL_MESSAGE_TYPE_PREFIX}LeftChatMember`,
|
|
11
|
+
NewChatMember: `${INTERNAL_MESSAGE_TYPE_PREFIX}NewChatMember`,
|
|
12
|
+
Poll: `${INTERNAL_MESSAGE_TYPE_PREFIX}Poll`,
|
|
13
|
+
Location: `${INTERNAL_MESSAGE_TYPE_PREFIX}Location`,
|
|
14
|
+
Photo: `${INTERNAL_MESSAGE_TYPE_PREFIX}Photo`,
|
|
15
|
+
Forward: `${INTERNAL_MESSAGE_TYPE_PREFIX}Forward`,
|
|
16
|
+
Video: `${INTERNAL_MESSAGE_TYPE_PREFIX}Video`,
|
|
17
|
+
Unknown: `${INTERNAL_MESSAGE_TYPE_PREFIX}Unknown`
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChatContext } from '../entities/context/chatContext';
|
|
2
|
+
import { InlineQueryContext } from '../entities/context/inlineQueryContext';
|
|
3
|
+
import { MessageContext } from '../entities/context/messageContext';
|
|
4
|
+
import { IActionState } from './actionState';
|
|
5
|
+
export type CommandActionPropertyProvider<T> = (ctx: MessageContext<IActionState>) => T;
|
|
6
|
+
export type InlineActionPropertyProvider<T> = (ctx: InlineQueryContext) => T;
|
|
7
|
+
export type ScheduledActionPropertyProvider<T> = (ctx: ChatContext<IActionState>) => T;
|
|
8
|
+
//# sourceMappingURL=propertyProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertyProvider.d.ts","sourceRoot":"","sources":["../../types/propertyProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,MAAM,6BAA6B,CAAC,CAAC,IAAI,CAC3C,GAAG,EAAE,cAAc,CAAC,YAAY,CAAC,KAChC,CAAC,CAAC;AAEP,MAAM,MAAM,4BAA4B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,KAAK,CAAC,CAAC;AAE7E,MAAM,MAAM,+BAA+B,CAAC,CAAC,IAAI,CAC7C,GAAG,EAAE,WAAW,CAAC,YAAY,CAAC,KAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ChatInfo } from '../dtos/chatInfo';
|
|
2
|
+
import { DelayResponse } from '../dtos/responses/delay';
|
|
3
|
+
import { ImageMessage } from '../dtos/responses/imageMessage';
|
|
4
|
+
import { InlineQueryResponse } from '../dtos/responses/inlineQueryResponse';
|
|
5
|
+
import { Reaction } from '../dtos/responses/reaction';
|
|
6
|
+
import { TextMessage } from '../dtos/responses/textMessage';
|
|
7
|
+
import { UnpinResponse } from '../dtos/responses/unpin';
|
|
8
|
+
import { VideoMessage } from '../dtos/responses/videoMessage';
|
|
9
|
+
import { IReplyCapture } from './capture';
|
|
10
|
+
import { ReplyInfo } from '../dtos/replyInfo';
|
|
11
|
+
import { TraceId } from './trace';
|
|
12
|
+
import { IAction } from './action';
|
|
13
|
+
export declare const BotResponseTypes: {
|
|
14
|
+
readonly unpin: "unpin";
|
|
15
|
+
readonly text: "text";
|
|
16
|
+
readonly image: "image";
|
|
17
|
+
readonly video: "video";
|
|
18
|
+
readonly react: "react";
|
|
19
|
+
readonly delay: "delay";
|
|
20
|
+
readonly inlineQuery: "inlineQuery";
|
|
21
|
+
};
|
|
22
|
+
export type BotResponse = UnpinResponse | Reaction | TextMessage | VideoMessage | DelayResponse | InlineQueryResponse | ImageMessage;
|
|
23
|
+
export interface IChatResponse {
|
|
24
|
+
readonly kind: keyof typeof BotResponseTypes;
|
|
25
|
+
readonly chatInfo: ChatInfo;
|
|
26
|
+
readonly traceId: TraceId;
|
|
27
|
+
readonly createdAt: number;
|
|
28
|
+
readonly action: IAction;
|
|
29
|
+
}
|
|
30
|
+
export interface IReplyResponse extends IChatResponse {
|
|
31
|
+
readonly captures: IReplyCapture[];
|
|
32
|
+
readonly replyInfo: ReplyInfo | undefined;
|
|
33
|
+
readonly disableWebPreview: boolean;
|
|
34
|
+
readonly shouldPin: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface IReplyResponseWithContent<TType> extends IReplyResponse {
|
|
37
|
+
readonly content: TType;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../types/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,eAAO,MAAM,gBAAgB;;;;;;;;CAQnB,CAAC;AAEX,MAAM,MAAM,WAAW,GACjB,aAAa,GACb,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,aAAa,GACb,mBAAmB,GACnB,YAAY,CAAC;AAEnB,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,gBAAgB,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IACjD,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,yBAAyB,CAAC,KAAK,CAAE,SAAQ,cAAc;IACpE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;CAC3B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Milliseconds } from './timeValues';
|
|
2
|
+
export interface IScheduler {
|
|
3
|
+
stopAll(): void;
|
|
4
|
+
createTask(name: string, action: () => unknown, interval: Milliseconds, executeRightAway: boolean, ownerName: string): void;
|
|
5
|
+
createOnetimeTask(name: string, action: () => unknown, delay: Milliseconds, ownerName: string): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../types/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,UAAU;IACvB,OAAO,IAAI,IAAI,CAAC;IAEhB,UAAU,CACN,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,OAAO,EACrB,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,OAAO,EACzB,SAAS,EAAE,MAAM,GAClB,IAAI,CAAC;IAER,iBAAiB,CACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,OAAO,EACrB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,GAClB,IAAI,CAAC;CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IActionState } from './actionState';
|
|
2
|
+
import { ActionKey, IActionWithState } from './action';
|
|
3
|
+
export interface IStorageClient {
|
|
4
|
+
updateStateFor<TActionState extends IActionState>(action: IActionWithState<TActionState>, chatId: number, update: (state: TActionState) => Promise<void> | void): Promise<void>;
|
|
5
|
+
close(): Promise<void>;
|
|
6
|
+
load<TActionState extends IActionState>(key: ActionKey): Promise<Record<number, TActionState | undefined>>;
|
|
7
|
+
saveMetadata<TActionState extends IActionState>(actions: IActionWithState<TActionState>[]): Promise<void>;
|
|
8
|
+
getActionState<TActionState extends IActionState>(action: IActionWithState<TActionState>, chatId: number): Promise<TActionState>;
|
|
9
|
+
saveActionExecutionResult<TActionState extends IActionState>(action: IActionWithState<TActionState>, chatId: number, state: TActionState): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../types/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,WAAW,cAAc;IAC3B,cAAc,CAAC,YAAY,SAAS,YAAY,EAC5C,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACtC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GACtD,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,CAAC,YAAY,SAAS,YAAY,EAClC,GAAG,EAAE,SAAS,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC;IACrD,YAAY,CAAC,YAAY,SAAS,YAAY,EAC1C,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAAE,GAC1C,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,cAAc,CAAC,YAAY,SAAS,YAAY,EAC5C,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACtC,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC,CAAC;IACzB,yBAAyB,CAAC,YAAY,SAAS,YAAY,EACvD,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACtC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const millisecondsSymbol: unique symbol;
|
|
2
|
+
declare const secondsSymbol: unique symbol;
|
|
3
|
+
declare const hoursSymbol: unique symbol;
|
|
4
|
+
export type Milliseconds = number & {
|
|
5
|
+
[millisecondsSymbol]: never;
|
|
6
|
+
};
|
|
7
|
+
export type Seconds = number & {
|
|
8
|
+
[secondsSymbol]: never;
|
|
9
|
+
};
|
|
10
|
+
export type Hours = number & {
|
|
11
|
+
[hoursSymbol]: never;
|
|
12
|
+
};
|
|
13
|
+
export type HoursOfDay = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=timeValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeValues.d.ts","sourceRoot":"","sources":["../../types/timeValues.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAC;AAChD,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC;AAC3C,OAAO,CAAC,MAAM,WAAW,EAAE,OAAO,MAAM,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,CAAC,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AACpE,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,CAAC,aAAa,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAC1D,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,CAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEtD,MAAM,MAAM,UAAU,GAChB,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,CAAC,GACD,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,GACF,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../types/trace.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,WAAW,EAAE,OAAO,MAAM,CAAC;AAEzC,MAAM,MAAM,OAAO,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,GAAG;IACpD,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;CACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|