chz-telegram-bot 0.5.1 → 0.5.3

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.
Files changed (222) hide show
  1. package/dtos/chatHistoryMessage.ts +9 -1
  2. package/entities/botInstance.ts +1 -1
  3. package/entities/context/messageContext.ts +3 -3
  4. package/entities/context/replyContext.ts +3 -3
  5. package/{eslint.config.js → eslint.config.ts} +8 -5
  6. package/index.ts +3 -0
  7. package/package.json +38 -37
  8. package/services/actionProcessors/commandActionProcessor.ts +7 -7
  9. package/services/jsonFileStorage.ts +1 -1
  10. package/services/nodeTimeoutScheduler.ts +2 -2
  11. package/tsconfig.json +2 -2
  12. package/bun.lock +0 -301
  13. package/dist/builtin/helpAction.d.ts +0 -2
  14. package/dist/builtin/helpAction.d.ts.map +0 -1
  15. package/dist/builtin/helpAction.js +0 -17
  16. package/dist/dtos/chatHistoryMessage.d.ts +0 -13
  17. package/dist/dtos/chatHistoryMessage.d.ts.map +0 -1
  18. package/dist/dtos/chatHistoryMessage.js +0 -20
  19. package/dist/dtos/chatInfo.d.ts +0 -17
  20. package/dist/dtos/chatInfo.d.ts.map +0 -1
  21. package/dist/dtos/chatInfo.js +0 -20
  22. package/dist/dtos/commandTriggerCheckResult.d.ts +0 -24
  23. package/dist/dtos/commandTriggerCheckResult.d.ts.map +0 -1
  24. package/dist/dtos/commandTriggerCheckResult.js +0 -38
  25. package/dist/dtos/cooldownInfo.d.ts +0 -13
  26. package/dist/dtos/cooldownInfo.d.ts.map +0 -1
  27. package/dist/dtos/cooldownInfo.js +0 -16
  28. package/dist/dtos/incomingMessage.d.ts +0 -19
  29. package/dist/dtos/incomingMessage.d.ts.map +0 -1
  30. package/dist/dtos/incomingMessage.js +0 -67
  31. package/dist/dtos/incomingQuery.d.ts +0 -10
  32. package/dist/dtos/incomingQuery.d.ts.map +0 -1
  33. package/dist/dtos/incomingQuery.js +0 -18
  34. package/dist/dtos/messageInfo.d.ts +0 -22
  35. package/dist/dtos/messageInfo.d.ts.map +0 -1
  36. package/dist/dtos/messageInfo.js +0 -24
  37. package/dist/dtos/propertyProviderSets.d.ts +0 -16
  38. package/dist/dtos/propertyProviderSets.d.ts.map +0 -1
  39. package/dist/dtos/propertyProviderSets.js +0 -2
  40. package/dist/dtos/replyInfo.d.ts +0 -6
  41. package/dist/dtos/replyInfo.d.ts.map +0 -1
  42. package/dist/dtos/replyInfo.js +0 -12
  43. package/dist/dtos/responses/delay.d.ts +0 -16
  44. package/dist/dtos/responses/delay.d.ts.map +0 -1
  45. package/dist/dtos/responses/delay.js +0 -19
  46. package/dist/dtos/responses/imageMessage.d.ts +0 -22
  47. package/dist/dtos/responses/imageMessage.d.ts.map +0 -1
  48. package/dist/dtos/responses/imageMessage.js +0 -25
  49. package/dist/dtos/responses/inlineQueryResponse.d.ts +0 -13
  50. package/dist/dtos/responses/inlineQueryResponse.d.ts.map +0 -1
  51. package/dist/dtos/responses/inlineQueryResponse.js +0 -19
  52. package/dist/dtos/responses/reaction.d.ts +0 -16
  53. package/dist/dtos/responses/reaction.d.ts.map +0 -1
  54. package/dist/dtos/responses/reaction.js +0 -21
  55. package/dist/dtos/responses/textMessage.d.ts +0 -23
  56. package/dist/dtos/responses/textMessage.d.ts.map +0 -1
  57. package/dist/dtos/responses/textMessage.js +0 -28
  58. package/dist/dtos/responses/unpin.d.ts +0 -15
  59. package/dist/dtos/responses/unpin.d.ts.map +0 -1
  60. package/dist/dtos/responses/unpin.js +0 -19
  61. package/dist/dtos/responses/videoMessage.d.ts +0 -22
  62. package/dist/dtos/responses/videoMessage.d.ts.map +0 -1
  63. package/dist/dtos/responses/videoMessage.js +0 -25
  64. package/dist/dtos/userInfo.d.ts +0 -12
  65. package/dist/dtos/userInfo.d.ts.map +0 -1
  66. package/dist/dtos/userInfo.js +0 -16
  67. package/dist/entities/actions/commandAction.d.ts +0 -31
  68. package/dist/entities/actions/commandAction.d.ts.map +0 -1
  69. package/dist/entities/actions/commandAction.js +0 -146
  70. package/dist/entities/actions/inlineQueryAction.d.ts +0 -14
  71. package/dist/entities/actions/inlineQueryAction.d.ts.map +0 -1
  72. package/dist/entities/actions/inlineQueryAction.js +0 -47
  73. package/dist/entities/actions/replyCaptureAction.d.ts +0 -15
  74. package/dist/entities/actions/replyCaptureAction.d.ts.map +0 -1
  75. package/dist/entities/actions/replyCaptureAction.js +0 -62
  76. package/dist/entities/actions/scheduledAction.d.ts +0 -24
  77. package/dist/entities/actions/scheduledAction.d.ts.map +0 -1
  78. package/dist/entities/actions/scheduledAction.js +0 -79
  79. package/dist/entities/botInstance.d.ts +0 -37
  80. package/dist/entities/botInstance.d.ts.map +0 -1
  81. package/dist/entities/botInstance.js +0 -41
  82. package/dist/entities/cachedStateFactory.d.ts +0 -7
  83. package/dist/entities/cachedStateFactory.d.ts.map +0 -1
  84. package/dist/entities/cachedStateFactory.js +0 -12
  85. package/dist/entities/context/baseContext.d.ts +0 -39
  86. package/dist/entities/context/baseContext.d.ts.map +0 -1
  87. package/dist/entities/context/baseContext.js +0 -59
  88. package/dist/entities/context/chatContext.d.ts +0 -50
  89. package/dist/entities/context/chatContext.d.ts.map +0 -1
  90. package/dist/entities/context/chatContext.js +0 -69
  91. package/dist/entities/context/inlineQueryContext.d.ts +0 -27
  92. package/dist/entities/context/inlineQueryContext.d.ts.map +0 -1
  93. package/dist/entities/context/inlineQueryContext.js +0 -33
  94. package/dist/entities/context/messageContext.d.ts +0 -92
  95. package/dist/entities/context/messageContext.d.ts.map +0 -1
  96. package/dist/entities/context/messageContext.js +0 -120
  97. package/dist/entities/context/replyContext.d.ts +0 -89
  98. package/dist/entities/context/replyContext.d.ts.map +0 -1
  99. package/dist/entities/context/replyContext.js +0 -128
  100. package/dist/entities/states/actionStateBase.d.ts +0 -6
  101. package/dist/entities/states/actionStateBase.d.ts.map +0 -1
  102. package/dist/entities/states/actionStateBase.js +0 -8
  103. package/dist/entities/taskRecord.d.ts +0 -8
  104. package/dist/entities/taskRecord.d.ts.map +0 -1
  105. package/dist/entities/taskRecord.js +0 -14
  106. package/dist/helpers/builders/commandActionBuilder.d.ts +0 -100
  107. package/dist/helpers/builders/commandActionBuilder.d.ts.map +0 -1
  108. package/dist/helpers/builders/commandActionBuilder.js +0 -151
  109. package/dist/helpers/builders/inlineQueryActionBuilder.d.ts +0 -37
  110. package/dist/helpers/builders/inlineQueryActionBuilder.d.ts.map +0 -1
  111. package/dist/helpers/builders/inlineQueryActionBuilder.js +0 -54
  112. package/dist/helpers/builders/scheduledActionBuilder.d.ts +0 -68
  113. package/dist/helpers/builders/scheduledActionBuilder.d.ts.map +0 -1
  114. package/dist/helpers/builders/scheduledActionBuilder.js +0 -100
  115. package/dist/helpers/mapUtils.d.ts +0 -10
  116. package/dist/helpers/mapUtils.d.ts.map +0 -1
  117. package/dist/helpers/mapUtils.js +0 -17
  118. package/dist/helpers/noop.d.ts +0 -9
  119. package/dist/helpers/noop.d.ts.map +0 -1
  120. package/dist/helpers/noop.js +0 -21
  121. package/dist/helpers/objectFromEntries.d.ts +0 -2
  122. package/dist/helpers/objectFromEntries.d.ts.map +0 -1
  123. package/dist/helpers/objectFromEntries.js +0 -7
  124. package/dist/helpers/timeConvertions.d.ts +0 -5
  125. package/dist/helpers/timeConvertions.d.ts.map +0 -1
  126. package/dist/helpers/timeConvertions.js +0 -14
  127. package/dist/helpers/toArray.d.ts +0 -2
  128. package/dist/helpers/toArray.d.ts.map +0 -1
  129. package/dist/helpers/toArray.js +0 -6
  130. package/dist/helpers/traceFactory.d.ts +0 -3
  131. package/dist/helpers/traceFactory.d.ts.map +0 -1
  132. package/dist/helpers/traceFactory.js +0 -6
  133. package/dist/index.d.ts +0 -24
  134. package/dist/index.d.ts.map +0 -1
  135. package/dist/index.js +0 -41
  136. package/dist/main.d.ts +0 -52
  137. package/dist/main.d.ts.map +0 -1
  138. package/dist/main.js +0 -37
  139. package/dist/services/actionProcessingService.d.ts +0 -25
  140. package/dist/services/actionProcessingService.d.ts.map +0 -1
  141. package/dist/services/actionProcessingService.js +0 -54
  142. package/dist/services/actionProcessors/baseProcessor.d.ts +0 -18
  143. package/dist/services/actionProcessors/baseProcessor.d.ts.map +0 -1
  144. package/dist/services/actionProcessors/baseProcessor.js +0 -33
  145. package/dist/services/actionProcessors/commandActionProcessor.d.ts +0 -20
  146. package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +0 -1
  147. package/dist/services/actionProcessors/commandActionProcessor.js +0 -119
  148. package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts +0 -11
  149. package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts.map +0 -1
  150. package/dist/services/actionProcessors/inlineQueryActionProcessor.js +0 -65
  151. package/dist/services/actionProcessors/scheduledActionProcessor.d.ts +0 -17
  152. package/dist/services/actionProcessors/scheduledActionProcessor.d.ts.map +0 -1
  153. package/dist/services/actionProcessors/scheduledActionProcessor.js +0 -63
  154. package/dist/services/jsonFileStorage.d.ts +0 -23
  155. package/dist/services/jsonFileStorage.d.ts.map +0 -1
  156. package/dist/services/jsonFileStorage.js +0 -113
  157. package/dist/services/jsonLogger.d.ts +0 -11
  158. package/dist/services/jsonLogger.d.ts.map +0 -1
  159. package/dist/services/jsonLogger.js +0 -70
  160. package/dist/services/nodeTimeoutScheduler.d.ts +0 -13
  161. package/dist/services/nodeTimeoutScheduler.d.ts.map +0 -1
  162. package/dist/services/nodeTimeoutScheduler.js +0 -35
  163. package/dist/services/responseProcessingQueue.d.ts +0 -12
  164. package/dist/services/responseProcessingQueue.d.ts.map +0 -1
  165. package/dist/services/responseProcessingQueue.js +0 -41
  166. package/dist/services/telegramApi.d.ts +0 -23
  167. package/dist/services/telegramApi.d.ts.map +0 -1
  168. package/dist/services/telegramApi.js +0 -137
  169. package/dist/types/action.d.ts +0 -14
  170. package/dist/types/action.d.ts.map +0 -1
  171. package/dist/types/action.js +0 -2
  172. package/dist/types/actionState.d.ts +0 -5
  173. package/dist/types/actionState.d.ts.map +0 -1
  174. package/dist/types/actionState.js +0 -2
  175. package/dist/types/cachedValueAccessor.d.ts +0 -2
  176. package/dist/types/cachedValueAccessor.d.ts.map +0 -1
  177. package/dist/types/cachedValueAccessor.js +0 -2
  178. package/dist/types/capture.d.ts +0 -24
  179. package/dist/types/capture.d.ts.map +0 -1
  180. package/dist/types/capture.js +0 -2
  181. package/dist/types/commandCondition.d.ts +0 -8
  182. package/dist/types/commandCondition.d.ts.map +0 -1
  183. package/dist/types/commandCondition.js +0 -2
  184. package/dist/types/commandTrigger.d.ts +0 -2
  185. package/dist/types/commandTrigger.d.ts.map +0 -1
  186. package/dist/types/commandTrigger.js +0 -2
  187. package/dist/types/externalAliases.d.ts +0 -11
  188. package/dist/types/externalAliases.d.ts.map +0 -1
  189. package/dist/types/externalAliases.js +0 -2
  190. package/dist/types/handlers.d.ts +0 -21
  191. package/dist/types/handlers.d.ts.map +0 -1
  192. package/dist/types/handlers.js +0 -2
  193. package/dist/types/inputFile.d.ts +0 -5
  194. package/dist/types/inputFile.d.ts.map +0 -1
  195. package/dist/types/inputFile.js +0 -2
  196. package/dist/types/logger.d.ts +0 -13
  197. package/dist/types/logger.d.ts.map +0 -1
  198. package/dist/types/logger.js +0 -2
  199. package/dist/types/messageSendingOptions.d.ts +0 -9
  200. package/dist/types/messageSendingOptions.d.ts.map +0 -1
  201. package/dist/types/messageSendingOptions.js +0 -2
  202. package/dist/types/messageTypes.d.ts +0 -20
  203. package/dist/types/messageTypes.d.ts.map +0 -1
  204. package/dist/types/messageTypes.js +0 -21
  205. package/dist/types/propertyProvider.d.ts +0 -8
  206. package/dist/types/propertyProvider.d.ts.map +0 -1
  207. package/dist/types/propertyProvider.js +0 -2
  208. package/dist/types/response.d.ts +0 -39
  209. package/dist/types/response.d.ts.map +0 -1
  210. package/dist/types/response.js +0 -12
  211. package/dist/types/scheduler.d.ts +0 -7
  212. package/dist/types/scheduler.d.ts.map +0 -1
  213. package/dist/types/scheduler.js +0 -2
  214. package/dist/types/storage.d.ts +0 -11
  215. package/dist/types/storage.d.ts.map +0 -1
  216. package/dist/types/storage.js +0 -2
  217. package/dist/types/timeValues.d.ts +0 -15
  218. package/dist/types/timeValues.d.ts.map +0 -1
  219. package/dist/types/timeValues.js +0 -2
  220. package/dist/types/trace.d.ts +0 -6
  221. package/dist/types/trace.d.ts.map +0 -1
  222. package/dist/types/trace.js +0 -2
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResponseProcessingQueue = void 0;
4
- const async_sema_1 = require("async-sema");
5
- function notEmpty(arr) {
6
- return arr.length > 0;
7
- }
8
- const TELEGRAM_RATELIMIT_DELAY = 35;
9
- class ResponseProcessingQueue {
10
- rateLimiter = (0, async_sema_1.RateLimit)(1, { timeUnit: TELEGRAM_RATELIMIT_DELAY });
11
- items = [];
12
- isFlushing = false;
13
- enqueue(item) {
14
- if (this.items.length === 0 ||
15
- item.priority >= this.items[this.items.length - 1].priority) {
16
- this.items.push(item);
17
- return;
18
- }
19
- let insertIndex = this.items.length;
20
- while (insertIndex > 0 &&
21
- this.items[insertIndex - 1].priority > item.priority) {
22
- insertIndex--;
23
- }
24
- this.items.splice(insertIndex, 0, item);
25
- }
26
- async flushReadyItems() {
27
- if (this.isFlushing)
28
- return;
29
- this.isFlushing = true;
30
- while (notEmpty(this.items)) {
31
- if (Date.now() >= this.items[0].priority) {
32
- await this.rateLimiter();
33
- const [item] = this.items;
34
- this.items.shift();
35
- await item.callback();
36
- }
37
- }
38
- this.isFlushing = false;
39
- }
40
- }
41
- exports.ResponseProcessingQueue = ResponseProcessingQueue;
@@ -1,23 +0,0 @@
1
- import { IStorageClient } from '../types/storage';
2
- import { BotResponse } from '../types/response';
3
- import { ILogger } from '../types/logger';
4
- import { IReplyCapture } from '../types/capture';
5
- import { TraceId } from '../types/trace';
6
- import { ChatInfo } from '../dtos/chatInfo';
7
- import { TelegramApiClient } from '../types/externalAliases';
8
- export declare const TELEGRAM_ERROR_QUOTE_INVALID = "QUOTE_TEXT_INVALID";
9
- export declare class TelegramApiService {
10
- private readonly queue;
11
- private readonly telegram;
12
- private readonly storage;
13
- private readonly logger;
14
- private readonly captureRegistrationCallback;
15
- private readonly botName;
16
- constructor(botName: string, telegram: TelegramApiClient, storage: IStorageClient, logger: ILogger, captureRegistrationCallback: (capture: IReplyCapture, parentMessageId: number, chatInfo: ChatInfo, traceId: TraceId) => void);
17
- enqueueBatchedResponses(responses: BotResponse[]): void;
18
- flushResponses(): void;
19
- private pinIfShould;
20
- private processResponse;
21
- private sendApiRequest;
22
- }
23
- //# sourceMappingURL=telegramApi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"telegramApi.d.ts","sourceRoot":"","sources":["../../services/telegramApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAmB,MAAM,0BAA0B,CAAC;AAE9E,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,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAKlC;IAEV,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAG7B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,OAAO,EACf,2BAA2B,EAAE,CACzB,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,KACf,IAAI;IASb,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE;IAwDhD,cAAc;YAIA,WAAW;YAqBX,eAAe;YAiBf,cAAc;CA6F/B"}
@@ -1,137 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TelegramApiService = exports.TELEGRAM_ERROR_QUOTE_INVALID = void 0;
4
- const responseProcessingQueue_1 = require("./responseProcessingQueue");
5
- exports.TELEGRAM_ERROR_QUOTE_INVALID = 'QUOTE_TEXT_INVALID';
6
- class TelegramApiService {
7
- queue = new responseProcessingQueue_1.ResponseProcessingQueue();
8
- telegram;
9
- storage;
10
- logger;
11
- captureRegistrationCallback;
12
- botName;
13
- constructor(botName, telegram, storage, logger, captureRegistrationCallback) {
14
- this.telegram = telegram;
15
- this.botName = botName;
16
- this.storage = storage;
17
- this.logger = logger;
18
- this.captureRegistrationCallback = captureRegistrationCallback;
19
- }
20
- enqueueBatchedResponses(responses) {
21
- let offset = 0;
22
- for (const response of responses) {
23
- if (response.kind == 'delay') {
24
- offset += response.delay;
25
- continue;
26
- }
27
- const queueItem = {
28
- callback: async () => {
29
- const scopedLogger = this.logger.createScope(this.botName, response.traceId, 'chatInfo' in response
30
- ? response.chatInfo.name
31
- : 'Unknown');
32
- try {
33
- await this.processResponse(response);
34
- }
35
- catch (error) {
36
- if ('message' in error) {
37
- const telegramResponse = error;
38
- if (telegramResponse.message.includes(exports.TELEGRAM_ERROR_QUOTE_INVALID)) {
39
- scopedLogger.logWithTraceId('Quote error recieved, retrying without quote');
40
- try {
41
- await this.processResponse(response, true);
42
- }
43
- catch (error) {
44
- scopedLogger.errorWithTraceId(error, response);
45
- }
46
- return;
47
- }
48
- }
49
- scopedLogger.errorWithTraceId(error, response);
50
- }
51
- },
52
- priority: response.createdAt + offset
53
- };
54
- this.queue.enqueue(queueItem);
55
- }
56
- }
57
- flushResponses() {
58
- void this.queue.flushReadyItems();
59
- }
60
- async pinIfShould(response, message) {
61
- if (response.shouldPin) {
62
- await this.telegram.pinChatMessage(response.chatInfo.id, message.message_id, { disable_notification: true });
63
- await this.storage.updateStateFor(response.action, response.chatInfo.id, (state) => {
64
- state.pinnedMessages.push(message.message_id);
65
- });
66
- }
67
- }
68
- async processResponse(response, ignoreQuote = false) {
69
- const sentMessage = await this.sendApiRequest(response, ignoreQuote);
70
- if (sentMessage && 'content' in response) {
71
- await this.pinIfShould(response, sentMessage);
72
- for (const capture of response.captures) {
73
- this.captureRegistrationCallback(capture, sentMessage.message_id, response.chatInfo, response.traceId);
74
- }
75
- }
76
- }
77
- async sendApiRequest(response, ignoreQuote) {
78
- switch (response.kind) {
79
- case 'text':
80
- return await this.telegram.sendMessage(response.chatInfo.id, response.content, {
81
- reply_parameters: response.replyInfo
82
- ? {
83
- message_id: response.replyInfo.id,
84
- quote: ignoreQuote
85
- ? undefined
86
- : response.replyInfo.quote
87
- }
88
- : undefined,
89
- parse_mode: 'MarkdownV2',
90
- link_preview_options: {
91
- is_disabled: response.disableWebPreview
92
- },
93
- reply_markup: response.keyboard
94
- ? {
95
- inline_keyboard: response.keyboard
96
- }
97
- : undefined
98
- });
99
- case 'image':
100
- return await this.telegram.sendPhoto(response.chatInfo.id, response.content,
101
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
102
- response.replyInfo?.id
103
- ? {
104
- reply_to_message_id: response.replyInfo.id // eslint-disable-next-line @typescript-eslint/no-explicit-any
105
- }
106
- : undefined);
107
- case 'video':
108
- return await this.telegram.sendVideo(response.chatInfo.id, response.content,
109
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
110
- response.replyInfo?.id
111
- ? {
112
- reply_to_message_id: response.replyInfo.id // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
- }
114
- : undefined);
115
- case 'react':
116
- await this.telegram.setMessageReaction(response.chatInfo.id, response.messageId, [
117
- {
118
- type: 'emoji',
119
- emoji: response.emoji
120
- }
121
- ]);
122
- return null;
123
- case 'unpin':
124
- await this.telegram.unpinChatMessage(response.chatInfo.id, response.messageId);
125
- await this.storage.updateStateFor(response.action, response.chatInfo.id, (state) => {
126
- state.pinnedMessages = state.pinnedMessages.filter((x) => x != response.messageId);
127
- });
128
- return null;
129
- case 'inlineQuery':
130
- await this.telegram.answerInlineQuery(response.queryId, response.queryResults, { cache_time: 0 });
131
- return null;
132
- case 'delay':
133
- return null;
134
- }
135
- }
136
- }
137
- exports.TelegramApiService = TelegramApiService;
@@ -1,14 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export interface IActionState {
2
- lastExecutedDate: number;
3
- pinnedMessages: number[];
4
- }
5
- //# sourceMappingURL=actionState.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- export type CachedValueAccessor = <TResult>(key: string) => Promise<TResult>;
2
- //# sourceMappingURL=cachedValueAccessor.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,24 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- export type CommandTrigger = string | RegExp;
2
- //# sourceMappingURL=commandTrigger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandTrigger.d.ts","sourceRoot":"","sources":["../../types/commandTrigger.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,21 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export interface InputFile {
2
- source: string;
3
- filename?: string;
4
- }
5
- //# sourceMappingURL=inputFile.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,13 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,20 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageType = exports.INTERNAL_MESSAGE_TYPE_PREFIX = void 0;
4
- exports.INTERNAL_MESSAGE_TYPE_PREFIX = `__msg:`;
5
- exports.MessageType = {
6
- Any: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Any`,
7
- Text: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Text`,
8
- Sticker: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Sticker`,
9
- Animation: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Animation`,
10
- Document: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Document`,
11
- Voice: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Voice`,
12
- Audio: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Audio`,
13
- LeftChatMember: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}LeftChatMember`,
14
- NewChatMember: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}NewChatMember`,
15
- Poll: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Poll`,
16
- Location: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Location`,
17
- Photo: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Photo`,
18
- Forward: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Forward`,
19
- Video: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Video`,
20
- Unknown: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Unknown`
21
- };
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,39 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BotResponseTypes = void 0;
4
- exports.BotResponseTypes = {
5
- unpin: 'unpin',
6
- text: 'text',
7
- image: 'image',
8
- video: 'video',
9
- react: 'react',
10
- delay: 'delay',
11
- inlineQuery: 'inlineQuery'
12
- };
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });