chz-telegram-bot 0.5.2 → 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.
- package/dtos/chatHistoryMessage.ts +9 -1
- package/package.json +38 -38
- package/services/actionProcessors/commandActionProcessor.ts +2 -1
- package/dist/builtin/helpAction.d.ts +0 -2
- package/dist/builtin/helpAction.d.ts.map +0 -1
- package/dist/builtin/helpAction.js +0 -14
- package/dist/dtos/chatHistoryMessage.d.ts +0 -13
- package/dist/dtos/chatHistoryMessage.d.ts.map +0 -1
- package/dist/dtos/chatHistoryMessage.js +0 -16
- package/dist/dtos/chatInfo.d.ts +0 -17
- package/dist/dtos/chatInfo.d.ts.map +0 -1
- package/dist/dtos/chatInfo.js +0 -16
- package/dist/dtos/commandTriggerCheckResult.d.ts +0 -24
- package/dist/dtos/commandTriggerCheckResult.d.ts.map +0 -1
- package/dist/dtos/commandTriggerCheckResult.js +0 -34
- package/dist/dtos/cooldownInfo.d.ts +0 -13
- package/dist/dtos/cooldownInfo.d.ts.map +0 -1
- package/dist/dtos/cooldownInfo.js +0 -12
- package/dist/dtos/incomingMessage.d.ts +0 -19
- package/dist/dtos/incomingMessage.d.ts.map +0 -1
- package/dist/dtos/incomingMessage.js +0 -63
- package/dist/dtos/incomingQuery.d.ts +0 -10
- package/dist/dtos/incomingQuery.d.ts.map +0 -1
- package/dist/dtos/incomingQuery.js +0 -14
- package/dist/dtos/messageInfo.d.ts +0 -22
- package/dist/dtos/messageInfo.d.ts.map +0 -1
- package/dist/dtos/messageInfo.js +0 -20
- package/dist/dtos/propertyProviderSets.d.ts +0 -16
- package/dist/dtos/propertyProviderSets.d.ts.map +0 -1
- package/dist/dtos/propertyProviderSets.js +0 -1
- package/dist/dtos/replyInfo.d.ts +0 -6
- package/dist/dtos/replyInfo.d.ts.map +0 -1
- package/dist/dtos/replyInfo.js +0 -8
- package/dist/dtos/responses/delay.d.ts +0 -16
- package/dist/dtos/responses/delay.d.ts.map +0 -1
- package/dist/dtos/responses/delay.js +0 -15
- package/dist/dtos/responses/imageMessage.d.ts +0 -22
- package/dist/dtos/responses/imageMessage.d.ts.map +0 -1
- package/dist/dtos/responses/imageMessage.js +0 -21
- package/dist/dtos/responses/inlineQueryResponse.d.ts +0 -13
- package/dist/dtos/responses/inlineQueryResponse.d.ts.map +0 -1
- package/dist/dtos/responses/inlineQueryResponse.js +0 -15
- package/dist/dtos/responses/reaction.d.ts +0 -16
- package/dist/dtos/responses/reaction.d.ts.map +0 -1
- package/dist/dtos/responses/reaction.js +0 -17
- package/dist/dtos/responses/textMessage.d.ts +0 -23
- package/dist/dtos/responses/textMessage.d.ts.map +0 -1
- package/dist/dtos/responses/textMessage.js +0 -24
- package/dist/dtos/responses/unpin.d.ts +0 -15
- package/dist/dtos/responses/unpin.d.ts.map +0 -1
- package/dist/dtos/responses/unpin.js +0 -15
- package/dist/dtos/responses/videoMessage.d.ts +0 -22
- package/dist/dtos/responses/videoMessage.d.ts.map +0 -1
- package/dist/dtos/responses/videoMessage.js +0 -21
- package/dist/dtos/userInfo.d.ts +0 -12
- package/dist/dtos/userInfo.d.ts.map +0 -1
- package/dist/dtos/userInfo.js +0 -12
- package/dist/entities/actions/commandAction.d.ts +0 -31
- package/dist/entities/actions/commandAction.d.ts.map +0 -1
- package/dist/entities/actions/commandAction.js +0 -139
- package/dist/entities/actions/inlineQueryAction.d.ts +0 -14
- package/dist/entities/actions/inlineQueryAction.d.ts.map +0 -1
- package/dist/entities/actions/inlineQueryAction.js +0 -43
- package/dist/entities/actions/replyCaptureAction.d.ts +0 -15
- package/dist/entities/actions/replyCaptureAction.d.ts.map +0 -1
- package/dist/entities/actions/replyCaptureAction.js +0 -58
- package/dist/entities/actions/scheduledAction.d.ts +0 -24
- package/dist/entities/actions/scheduledAction.d.ts.map +0 -1
- package/dist/entities/actions/scheduledAction.js +0 -72
- package/dist/entities/botInstance.d.ts +0 -37
- package/dist/entities/botInstance.d.ts.map +0 -1
- package/dist/entities/botInstance.js +0 -37
- package/dist/entities/cachedStateFactory.d.ts +0 -7
- package/dist/entities/cachedStateFactory.d.ts.map +0 -1
- package/dist/entities/cachedStateFactory.js +0 -8
- package/dist/entities/context/baseContext.d.ts +0 -39
- package/dist/entities/context/baseContext.d.ts.map +0 -1
- package/dist/entities/context/baseContext.js +0 -55
- package/dist/entities/context/chatContext.d.ts +0 -50
- package/dist/entities/context/chatContext.d.ts.map +0 -1
- package/dist/entities/context/chatContext.js +0 -65
- package/dist/entities/context/inlineQueryContext.d.ts +0 -27
- package/dist/entities/context/inlineQueryContext.d.ts.map +0 -1
- package/dist/entities/context/inlineQueryContext.js +0 -29
- package/dist/entities/context/messageContext.d.ts +0 -92
- package/dist/entities/context/messageContext.d.ts.map +0 -1
- package/dist/entities/context/messageContext.js +0 -116
- package/dist/entities/context/replyContext.d.ts +0 -89
- package/dist/entities/context/replyContext.d.ts.map +0 -1
- package/dist/entities/context/replyContext.js +0 -124
- package/dist/entities/states/actionStateBase.d.ts +0 -6
- package/dist/entities/states/actionStateBase.d.ts.map +0 -1
- package/dist/entities/states/actionStateBase.js +0 -4
- package/dist/entities/taskRecord.d.ts +0 -8
- package/dist/entities/taskRecord.d.ts.map +0 -1
- package/dist/entities/taskRecord.js +0 -10
- package/dist/eslint.config.d.ts +0 -3
- package/dist/eslint.config.d.ts.map +0 -1
- package/dist/eslint.config.js +0 -51
- package/dist/helpers/builders/commandActionBuilder.d.ts +0 -100
- package/dist/helpers/builders/commandActionBuilder.d.ts.map +0 -1
- package/dist/helpers/builders/commandActionBuilder.js +0 -146
- package/dist/helpers/builders/inlineQueryActionBuilder.d.ts +0 -37
- package/dist/helpers/builders/inlineQueryActionBuilder.d.ts.map +0 -1
- package/dist/helpers/builders/inlineQueryActionBuilder.js +0 -50
- package/dist/helpers/builders/scheduledActionBuilder.d.ts +0 -68
- package/dist/helpers/builders/scheduledActionBuilder.d.ts.map +0 -1
- package/dist/helpers/builders/scheduledActionBuilder.js +0 -95
- package/dist/helpers/mapUtils.d.ts +0 -10
- package/dist/helpers/mapUtils.d.ts.map +0 -1
- package/dist/helpers/mapUtils.js +0 -13
- package/dist/helpers/noop.d.ts +0 -9
- package/dist/helpers/noop.d.ts.map +0 -1
- package/dist/helpers/noop.js +0 -17
- package/dist/helpers/objectFromEntries.d.ts +0 -2
- package/dist/helpers/objectFromEntries.d.ts.map +0 -1
- package/dist/helpers/objectFromEntries.js +0 -3
- package/dist/helpers/timeConvertions.d.ts +0 -5
- package/dist/helpers/timeConvertions.d.ts.map +0 -1
- package/dist/helpers/timeConvertions.js +0 -9
- package/dist/helpers/toArray.d.ts +0 -2
- package/dist/helpers/toArray.d.ts.map +0 -1
- package/dist/helpers/toArray.js +0 -3
- package/dist/helpers/traceFactory.d.ts +0 -3
- package/dist/helpers/traceFactory.d.ts.map +0 -1
- package/dist/helpers/traceFactory.js +0 -3
- package/dist/index.d.ts +0 -27
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -20
- package/dist/main.d.ts +0 -52
- package/dist/main.d.ts.map +0 -1
- package/dist/main.js +0 -34
- package/dist/services/actionProcessingService.d.ts +0 -25
- package/dist/services/actionProcessingService.d.ts.map +0 -1
- package/dist/services/actionProcessingService.js +0 -50
- package/dist/services/actionProcessors/baseProcessor.d.ts +0 -18
- package/dist/services/actionProcessors/baseProcessor.d.ts.map +0 -1
- package/dist/services/actionProcessors/baseProcessor.js +0 -29
- package/dist/services/actionProcessors/commandActionProcessor.d.ts +0 -20
- package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +0 -1
- package/dist/services/actionProcessors/commandActionProcessor.js +0 -116
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts +0 -11
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts.map +0 -1
- package/dist/services/actionProcessors/inlineQueryActionProcessor.js +0 -61
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts +0 -17
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts.map +0 -1
- package/dist/services/actionProcessors/scheduledActionProcessor.js +0 -56
- package/dist/services/jsonFileStorage.d.ts +0 -23
- package/dist/services/jsonFileStorage.d.ts.map +0 -1
- package/dist/services/jsonFileStorage.js +0 -109
- 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/dist/services/nodeTimeoutScheduler.d.ts +0 -13
- package/dist/services/nodeTimeoutScheduler.d.ts.map +0 -1
- package/dist/services/nodeTimeoutScheduler.js +0 -31
- package/dist/services/responseProcessingQueue.d.ts +0 -12
- package/dist/services/responseProcessingQueue.d.ts.map +0 -1
- package/dist/services/responseProcessingQueue.js +0 -37
- package/dist/services/telegramApi.d.ts +0 -23
- package/dist/services/telegramApi.d.ts.map +0 -1
- package/dist/services/telegramApi.js +0 -133
- package/dist/types/action.d.ts +0 -14
- package/dist/types/action.d.ts.map +0 -1
- package/dist/types/action.js +0 -1
- package/dist/types/actionState.d.ts +0 -5
- package/dist/types/actionState.d.ts.map +0 -1
- package/dist/types/actionState.js +0 -1
- package/dist/types/cachedValueAccessor.d.ts +0 -2
- package/dist/types/cachedValueAccessor.d.ts.map +0 -1
- package/dist/types/cachedValueAccessor.js +0 -1
- package/dist/types/capture.d.ts +0 -24
- package/dist/types/capture.d.ts.map +0 -1
- package/dist/types/capture.js +0 -1
- package/dist/types/commandCondition.d.ts +0 -8
- package/dist/types/commandCondition.d.ts.map +0 -1
- package/dist/types/commandCondition.js +0 -1
- package/dist/types/commandTrigger.d.ts +0 -2
- package/dist/types/commandTrigger.d.ts.map +0 -1
- package/dist/types/commandTrigger.js +0 -1
- package/dist/types/externalAliases.d.ts +0 -11
- package/dist/types/externalAliases.d.ts.map +0 -1
- package/dist/types/externalAliases.js +0 -1
- package/dist/types/handlers.d.ts +0 -21
- package/dist/types/handlers.d.ts.map +0 -1
- package/dist/types/handlers.js +0 -1
- package/dist/types/inputFile.d.ts +0 -5
- package/dist/types/inputFile.d.ts.map +0 -1
- package/dist/types/inputFile.js +0 -1
- package/dist/types/logger.d.ts +0 -13
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/logger.js +0 -1
- package/dist/types/messageSendingOptions.d.ts +0 -9
- package/dist/types/messageSendingOptions.d.ts.map +0 -1
- package/dist/types/messageSendingOptions.js +0 -1
- package/dist/types/messageTypes.d.ts +0 -20
- package/dist/types/messageTypes.d.ts.map +0 -1
- package/dist/types/messageTypes.js +0 -18
- package/dist/types/propertyProvider.d.ts +0 -8
- package/dist/types/propertyProvider.d.ts.map +0 -1
- package/dist/types/propertyProvider.js +0 -1
- package/dist/types/response.d.ts +0 -39
- package/dist/types/response.d.ts.map +0 -1
- package/dist/types/response.js +0 -9
- package/dist/types/scheduler.d.ts +0 -7
- package/dist/types/scheduler.d.ts.map +0 -1
- package/dist/types/scheduler.js +0 -1
- package/dist/types/storage.d.ts +0 -11
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js +0 -1
- package/dist/types/timeValues.d.ts +0 -15
- package/dist/types/timeValues.d.ts.map +0 -1
- package/dist/types/timeValues.js +0 -1
- package/dist/types/trace.d.ts +0 -6
- package/dist/types/trace.d.ts.map +0 -1
- package/dist/types/trace.js +0 -1
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export class JsonLogger {
|
|
2
|
-
serializeError(error) {
|
|
3
|
-
if (error instanceof Error) {
|
|
4
|
-
const plainObject = {
|
|
5
|
-
name: error.name,
|
|
6
|
-
message: error.message,
|
|
7
|
-
stack: error.stack
|
|
8
|
-
};
|
|
9
|
-
for (const [key, value] of Object.entries(error)) {
|
|
10
|
-
plainObject[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return JSON.stringify(plainObject);
|
|
13
|
-
}
|
|
14
|
-
return JSON.stringify({ error });
|
|
15
|
-
}
|
|
16
|
-
getCircularReplacer() {
|
|
17
|
-
const cache = new Set();
|
|
18
|
-
return (_, value) => {
|
|
19
|
-
if (typeof value === 'object' && value !== null) {
|
|
20
|
-
if (cache.has(value)) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
cache.add(value);
|
|
24
|
-
}
|
|
25
|
-
return value;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
createScope(botName, traceId, chatName) {
|
|
29
|
-
return {
|
|
30
|
-
logObjectWithTraceId: (data) => {
|
|
31
|
-
this.logObjectWithTraceId(botName, traceId, chatName, data);
|
|
32
|
-
},
|
|
33
|
-
logWithTraceId: (text) => {
|
|
34
|
-
this.logWithTraceId(botName, traceId, chatName, text);
|
|
35
|
-
},
|
|
36
|
-
errorWithTraceId: (errorObj, extraData) => {
|
|
37
|
-
this.errorWithTraceId(botName, traceId, chatName, errorObj, extraData);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
logObjectWithTraceId(botName, traceId, chatName, data) {
|
|
42
|
-
const enrichedData = typeof data == 'object'
|
|
43
|
-
? {
|
|
44
|
-
...data,
|
|
45
|
-
botName,
|
|
46
|
-
traceId,
|
|
47
|
-
chatName
|
|
48
|
-
}
|
|
49
|
-
: {
|
|
50
|
-
botName,
|
|
51
|
-
traceId,
|
|
52
|
-
chatName,
|
|
53
|
-
data
|
|
54
|
-
};
|
|
55
|
-
console.log(enrichedData);
|
|
56
|
-
}
|
|
57
|
-
logWithTraceId(botName, traceId, chatName, text) {
|
|
58
|
-
console.log(`{"botName":"${botName}","traceId":"${traceId}","chatName":"${chatName}","text":"${text}"}`);
|
|
59
|
-
}
|
|
60
|
-
errorWithTraceId(botName, traceId, chatName, errorObj, extraData) {
|
|
61
|
-
const dataString = extraData
|
|
62
|
-
? `,"extraData":${JSON.stringify(extraData, this.getCircularReplacer())}`
|
|
63
|
-
: '';
|
|
64
|
-
console.error(`{"botName":"${botName}","traceId":"${traceId}","chatName":"${chatName}","error":${this.serializeError(errorObj)}${dataString}}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TaskRecord } from '../entities/taskRecord';
|
|
2
|
-
import { ILogger } from '../types/logger';
|
|
3
|
-
import { IScheduler } from '../types/scheduler';
|
|
4
|
-
import { Milliseconds } from '../types/timeValues';
|
|
5
|
-
export declare class NodeTimeoutScheduler implements IScheduler {
|
|
6
|
-
private readonly logger;
|
|
7
|
-
readonly activeTasks: TaskRecord[];
|
|
8
|
-
constructor(logger: ILogger);
|
|
9
|
-
stopAll(): void;
|
|
10
|
-
createTask(name: string, action: () => unknown, interval: Milliseconds, executeRightAway: boolean, ownerName: string): void;
|
|
11
|
-
createOnetimeTask(name: string, action: () => unknown, delay: Milliseconds, ownerName: string): void;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=nodeTimeoutScheduler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeTimeoutScheduler.d.ts","sourceRoot":"","sources":["../../services/nodeTimeoutScheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,qBAAa,oBAAqB,YAAW,UAAU;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAClC,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAM;gBAE5B,MAAM,EAAE,OAAO;IAI3B,OAAO;IAMP,UAAU,CACN,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,OAAO,EACrB,QAAQ,EAAE,YAAY,EACtB,gBAAgB,EAAE,OAAO,EACzB,SAAS,EAAE,MAAM;IAmBrB,iBAAiB,CACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,OAAO,EACrB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM;CAoBxB"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { TaskRecord } from '../entities/taskRecord';
|
|
2
|
-
import { createTrace } from '../helpers/traceFactory';
|
|
3
|
-
export class NodeTimeoutScheduler {
|
|
4
|
-
logger;
|
|
5
|
-
activeTasks = [];
|
|
6
|
-
constructor(logger) {
|
|
7
|
-
this.logger = logger;
|
|
8
|
-
}
|
|
9
|
-
stopAll() {
|
|
10
|
-
for (const task of this.activeTasks) {
|
|
11
|
-
clearInterval(task.taskId);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
createTask(name, action, interval, executeRightAway, ownerName) {
|
|
15
|
-
const taskId = setInterval(action, interval);
|
|
16
|
-
const task = new TaskRecord(name, taskId, interval);
|
|
17
|
-
if (executeRightAway) {
|
|
18
|
-
setImmediate(action);
|
|
19
|
-
}
|
|
20
|
-
this.logger.logWithTraceId(ownerName, createTrace(this, ownerName, name), 'System', `Created task ${name}, that will run every ${interval}ms.`);
|
|
21
|
-
this.activeTasks.push(task);
|
|
22
|
-
}
|
|
23
|
-
createOnetimeTask(name, action, delay, ownerName) {
|
|
24
|
-
const actionWrapper = () => {
|
|
25
|
-
this.logger.logWithTraceId(ownerName, createTrace(this, ownerName, name), 'System', `Executing delayed oneshot ${name}`);
|
|
26
|
-
action();
|
|
27
|
-
};
|
|
28
|
-
setTimeout(actionWrapper, delay);
|
|
29
|
-
this.logger.logWithTraceId(ownerName, createTrace(this, ownerName, name), 'System', `Created oneshot task ${name}, that will run in ${delay}ms.`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type QueueItem = {
|
|
2
|
-
priority: number;
|
|
3
|
-
callback: () => Promise<void>;
|
|
4
|
-
};
|
|
5
|
-
export declare class ResponseProcessingQueue {
|
|
6
|
-
rateLimiter: () => Promise<void>;
|
|
7
|
-
items: QueueItem[];
|
|
8
|
-
isFlushing: boolean;
|
|
9
|
-
enqueue(item: QueueItem): void;
|
|
10
|
-
flushReadyItems(): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=responseProcessingQueue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"responseProcessingQueue.d.ts","sourceRoot":"","sources":["../../services/responseProcessingQueue.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,SAAS,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC,CAAC;AAQF,qBAAa,uBAAuB;IAChC,WAAW,sBAAwD;IACnE,KAAK,EAAE,SAAS,EAAE,CAAM;IACxB,UAAU,UAAS;IAEnB,OAAO,CAAC,IAAI,EAAE,SAAS;IAmBjB,eAAe;CAkBxB"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { RateLimit } from 'async-sema';
|
|
2
|
-
function notEmpty(arr) {
|
|
3
|
-
return arr.length > 0;
|
|
4
|
-
}
|
|
5
|
-
const TELEGRAM_RATELIMIT_DELAY = 35;
|
|
6
|
-
export class ResponseProcessingQueue {
|
|
7
|
-
rateLimiter = RateLimit(1, { timeUnit: TELEGRAM_RATELIMIT_DELAY });
|
|
8
|
-
items = [];
|
|
9
|
-
isFlushing = false;
|
|
10
|
-
enqueue(item) {
|
|
11
|
-
if (this.items.length === 0 ||
|
|
12
|
-
item.priority >= this.items[this.items.length - 1].priority) {
|
|
13
|
-
this.items.push(item);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
let insertIndex = this.items.length;
|
|
17
|
-
while (insertIndex > 0 &&
|
|
18
|
-
this.items[insertIndex - 1].priority > item.priority) {
|
|
19
|
-
insertIndex--;
|
|
20
|
-
}
|
|
21
|
-
this.items.splice(insertIndex, 0, item);
|
|
22
|
-
}
|
|
23
|
-
async flushReadyItems() {
|
|
24
|
-
if (this.isFlushing)
|
|
25
|
-
return;
|
|
26
|
-
this.isFlushing = true;
|
|
27
|
-
while (notEmpty(this.items)) {
|
|
28
|
-
if (Date.now() >= this.items[0].priority) {
|
|
29
|
-
await this.rateLimiter();
|
|
30
|
-
const [item] = this.items;
|
|
31
|
-
this.items.shift();
|
|
32
|
-
await item.callback();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
this.isFlushing = false;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -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,133 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/types/action.d.ts
DELETED
|
@@ -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"}
|
package/dist/types/action.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/capture.d.ts
DELETED
|
@@ -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"}
|
package/dist/types/capture.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/handlers.d.ts
DELETED
|
@@ -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"}
|
package/dist/types/handlers.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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"}
|
package/dist/types/inputFile.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/types/logger.d.ts
DELETED
|
@@ -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"}
|
package/dist/types/logger.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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,18 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export {};
|