chz-telegram-bot 0.7.3 → 0.7.6
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/entities/actions/commandAction.d.ts.map +1 -1
- package/dist/entities/actions/commandAction.js +4 -4
- package/dist/entities/actions/inlineQueryAction.d.ts.map +1 -1
- package/dist/entities/actions/inlineQueryAction.js +8 -5
- package/dist/entities/actions/replyCaptureAction.d.ts.map +1 -1
- package/dist/entities/actions/replyCaptureAction.js +4 -4
- package/dist/entities/actions/scheduledAction.d.ts.map +1 -1
- package/dist/entities/actions/scheduledAction.js +8 -6
- package/dist/entities/botInstance.d.ts.map +1 -1
- package/dist/entities/botInstance.js +7 -4
- package/dist/entities/context/baseContext.d.ts +6 -10
- package/dist/entities/context/baseContext.d.ts.map +1 -1
- package/dist/entities/context/baseContext.js +7 -11
- package/dist/entities/context/inlineQueryContext.d.ts +10 -7
- package/dist/entities/context/inlineQueryContext.d.ts.map +1 -1
- package/dist/entities/context/inlineQueryContext.js +6 -7
- package/dist/entities/context/messageContext.d.ts +12 -6
- package/dist/entities/context/messageContext.d.ts.map +1 -1
- package/dist/entities/context/messageContext.js +14 -4
- package/dist/entities/context/replyContext.d.ts +10 -6
- package/dist/entities/context/replyContext.d.ts.map +1 -1
- package/dist/entities/context/replyContext.js +11 -2
- package/dist/entities/taskRecord.d.ts +3 -1
- package/dist/entities/taskRecord.d.ts.map +1 -1
- package/dist/entities/taskRecord.js +3 -1
- package/dist/services/actionProcessingService.d.ts.map +1 -1
- package/dist/services/actionProcessingService.js +2 -2
- package/dist/services/actionProcessors/baseProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/baseProcessor.js +4 -5
- package/dist/services/actionProcessors/commandActionProcessor.d.ts +3 -4
- package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/commandActionProcessor.js +38 -56
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts +2 -1
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/inlineQueryActionProcessor.js +36 -25
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts +1 -1
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/scheduledActionProcessor.js +28 -22
- package/dist/services/jsonFileStorage.d.ts +1 -3
- package/dist/services/jsonFileStorage.d.ts.map +1 -1
- package/dist/services/jsonFileStorage.js +4 -33
- package/dist/services/nodeTimeoutScheduler.d.ts +2 -1
- package/dist/services/nodeTimeoutScheduler.d.ts.map +1 -1
- package/dist/services/nodeTimeoutScheduler.js +15 -6
- package/dist/services/telegramApi.d.ts +2 -1
- package/dist/services/telegramApi.d.ts.map +1 -1
- package/dist/services/telegramApi.js +14 -10
- package/dist/types/events.d.ts +28 -37
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/events.js +5 -9
- package/package.json +1 -1
- package/src/entities/actions/commandAction.ts +4 -7
- package/src/entities/actions/inlineQueryAction.ts +13 -8
- package/src/entities/actions/replyCaptureAction.ts +7 -10
- package/src/entities/actions/scheduledAction.ts +8 -9
- package/src/entities/botInstance.ts +7 -9
- package/src/entities/context/baseContext.ts +16 -18
- package/src/entities/context/inlineQueryContext.ts +33 -18
- package/src/entities/context/messageContext.ts +45 -6
- package/src/entities/context/replyContext.ts +47 -7
- package/src/entities/taskRecord.ts +7 -9
- package/src/services/actionProcessingService.ts +3 -2
- package/src/services/actionProcessors/baseProcessor.ts +8 -5
- package/src/services/actionProcessors/commandActionProcessor.ts +58 -93
- package/src/services/actionProcessors/inlineQueryActionProcessor.ts +81 -63
- package/src/services/actionProcessors/scheduledActionProcessor.ts +51 -42
- package/src/services/jsonFileStorage.ts +2 -41
- package/src/services/nodeTimeoutScheduler.ts +16 -6
- package/src/services/telegramApi.ts +18 -12
- package/src/types/events.ts +28 -55
- package/tests/entities/actions/inlineQueryAction.test.ts +26 -16
- package/tests/entities/actions/replyCaptureAction.test.ts +67 -24
- package/tests/entities/context/chatContext.test.ts +83 -38
- package/tests/entities/context/messageContext.test.ts +24 -23
- package/tests/entities/taskRecord.test.ts +100 -10
- package/tests/services/actionProcessors/baseActionProcessor.test.ts +36 -22
- package/tests/services/actionProcessors/commandActionProcessor.test.ts +34 -8
- package/tests/services/actionProcessors/inlineQueryActionProcessor.test.ts +199 -2
- package/tests/services/actionProcessors/scheduledActionProcessor.test.ts +39 -0
- package/tests/services/jsonFileStorage.test.ts +59 -130
- package/tests/services/nodeTimeoutScheduler.test.ts +11 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandAction.d.ts","sourceRoot":"","sources":["../../../src/entities/actions/commandAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAO/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,qBAAa,aAAa,CACtB,YAAY,SAAS,YAAY,CACnC,YAAW,gBAAgB,CAAC,YAAY,CAAC;IACvC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA8C;IACnF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAyC;IAC1E,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAErC;IACF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAErC;IACF,OAAO,CAA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AAsB,EACjC,gCAAgC,EAAE,MAAM,EACxC,SAAS,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACzC,gBAAgB,EAAE,MAAM,YAAY,EACpC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM;IAsBxC,IAAI,CACN,GAAG,EAAE,sBAAsB,CAAC,YAAY,CAAC,GAC1C,OAAO,CAAC,WAAW,EAAE,CAAC;IAqFzB,OAAO,CAAC,uBAAuB;IA6D/B,OAAO,CAAC,YAAY;CAuCvB"}
|
|
@@ -42,8 +42,6 @@ export class CommandAction {
|
|
|
42
42
|
this.key = `command:${this.name.replace('.', '-')}`;
|
|
43
43
|
}
|
|
44
44
|
async exec(ctx) {
|
|
45
|
-
if (!ctx.isInitialized)
|
|
46
|
-
throw new Error(`Context for ${this.key} is not initialized or already consumed`);
|
|
47
45
|
let lock;
|
|
48
46
|
if (this.maxAllowedSimultaniousExecutions != 0) {
|
|
49
47
|
lock = getOrSetIfNotExists(this.ratelimitSemaphores, ctx.chatInfo.id, new Semaphore(this.maxAllowedSimultaniousExecutions));
|
|
@@ -68,7 +66,8 @@ export class CommandAction {
|
|
|
68
66
|
ctx.eventEmitter.emit(BotEventType.commandActionExecuting, {
|
|
69
67
|
action: this,
|
|
70
68
|
ctx,
|
|
71
|
-
state
|
|
69
|
+
state,
|
|
70
|
+
traceId: ctx.traceId
|
|
72
71
|
});
|
|
73
72
|
ctx.matchResults = matchResults;
|
|
74
73
|
await this.handler(ctx, state);
|
|
@@ -83,7 +82,8 @@ export class CommandAction {
|
|
|
83
82
|
ctx.eventEmitter.emit(BotEventType.commandActionExecuted, {
|
|
84
83
|
action: this,
|
|
85
84
|
ctx,
|
|
86
|
-
state
|
|
85
|
+
state,
|
|
86
|
+
traceId: ctx.traceId
|
|
87
87
|
});
|
|
88
88
|
return ctx.responses;
|
|
89
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineQueryAction.d.ts","sourceRoot":"","sources":["../../../src/entities/actions/inlineQueryAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"inlineQueryAction.d.ts","sourceRoot":"","sources":["../../../src/entities/actions/inlineQueryAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAI5E,qBAAa,iBAAkB,YAAW,OAAO;IAC7C,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,gBAAgB,EAAE,4BAA4B,CAAC,OAAO,CAAC,CAAC;IACjE,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAGrB,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,4BAA4B,CAAC,OAAO,CAAC,EACrD,OAAO,EAAE,MAAM;IAUb,IAAI,CAAC,GAAG,EAAE,0BAA0B;CAkD7C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Noop } from '../../helpers/noop';
|
|
2
2
|
import { BotEventType } from '../../types/events';
|
|
3
|
+
import { InlineQueryResponse } from '../../dtos/responses/inlineQueryResponse';
|
|
3
4
|
export class InlineQueryAction {
|
|
4
5
|
key;
|
|
5
6
|
isActiveProvider;
|
|
@@ -14,8 +15,6 @@ export class InlineQueryAction {
|
|
|
14
15
|
this.key = `inline:${this.name.replace('.', '-')}`;
|
|
15
16
|
}
|
|
16
17
|
async exec(ctx) {
|
|
17
|
-
if (!ctx.isInitialized)
|
|
18
|
-
throw new Error(`Context for ${this.key} is not initialized or already consumed`);
|
|
19
18
|
if (!this.isActiveProvider(ctx))
|
|
20
19
|
return Noop.NoResponse;
|
|
21
20
|
const matchResults = [];
|
|
@@ -39,13 +38,17 @@ export class InlineQueryAction {
|
|
|
39
38
|
ctx.matchResults = matchResults;
|
|
40
39
|
ctx.eventEmitter.emit(BotEventType.inlineActionExecuting, {
|
|
41
40
|
action: this,
|
|
42
|
-
ctx
|
|
41
|
+
ctx,
|
|
42
|
+
traceId: ctx.traceId
|
|
43
43
|
});
|
|
44
44
|
await this.handler(ctx);
|
|
45
45
|
ctx.eventEmitter.emit(BotEventType.inlineActionExecuted, {
|
|
46
46
|
action: this,
|
|
47
|
-
ctx
|
|
47
|
+
ctx,
|
|
48
|
+
traceId: ctx.traceId
|
|
48
49
|
});
|
|
49
|
-
return
|
|
50
|
+
return [
|
|
51
|
+
new InlineQueryResponse(ctx.queryResults, ctx.queryId, ctx.traceId, ctx.action)
|
|
52
|
+
];
|
|
50
53
|
}
|
|
51
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replyCaptureAction.d.ts","sourceRoot":"","sources":["../../../src/entities/actions/replyCaptureAction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,qBAAa,kBAAkB,
|
|
1
|
+
{"version":3,"file":"replyCaptureAction.d.ts","sourceRoot":"","sources":["../../../src/entities/actions/replyCaptureAction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,qBAAa,kBAAkB,CAC3B,kBAAkB,SAAS,YAAY,CACzC,YAAW,OAAO;IAChB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,CACd,YAAY,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,KACrD,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;gBAGtC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,CACL,YAAY,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,KACrD,OAAO,CAAC,IAAI,CAAC,EAClB,QAAQ,EAAE,cAAc,EAAE,EAC1B,eAAe,EAAE,eAAe;IAY9B,IAAI,CAAC,GAAG,EAAE,oBAAoB,CAAC,kBAAkB,CAAC;IA2BxD,OAAO,CAAC,uBAAuB;CA4ClC"}
|
|
@@ -17,8 +17,6 @@ export class ReplyCaptureAction {
|
|
|
17
17
|
.replace('.', '')}`;
|
|
18
18
|
}
|
|
19
19
|
async exec(ctx) {
|
|
20
|
-
if (!ctx.isInitialized)
|
|
21
|
-
throw new Error(`Context for ${this.key} is not initialized or already consumed`);
|
|
22
20
|
const { shouldExecute, matchResults } = this.triggers
|
|
23
21
|
.map((x) => this.checkIfShouldBeExecuted(ctx, x))
|
|
24
22
|
.reduce((acc, curr) => acc.mergeWith(curr), CommandTriggerCheckResult.DoNotTrigger('Other'));
|
|
@@ -26,13 +24,15 @@ export class ReplyCaptureAction {
|
|
|
26
24
|
return Noop.NoResponse;
|
|
27
25
|
ctx.eventEmitter.emit(BotEventType.replyActionExecuting, {
|
|
28
26
|
action: this,
|
|
29
|
-
ctx
|
|
27
|
+
ctx,
|
|
28
|
+
traceId: ctx.traceId
|
|
30
29
|
});
|
|
31
30
|
ctx.matchResults = matchResults;
|
|
32
31
|
await this.handler(ctx);
|
|
33
32
|
ctx.eventEmitter.emit(BotEventType.replyActionExecuted, {
|
|
34
33
|
action: this,
|
|
35
|
-
ctx
|
|
34
|
+
ctx,
|
|
35
|
+
traceId: ctx.traceId
|
|
36
36
|
});
|
|
37
37
|
return ctx.responses;
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduledAction.d.ts","sourceRoot":"","sources":["../../../src/entities/actions/scheduledAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAI7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,qBAAa,eAAe,CACxB,YAAY,SAAS,YAAY,CACnC,YAAW,gBAAgB,CAAC,YAAY,CAAC;IACvC,MAAM,CAAC,QAAQ,CAAC,KAAK,yBAAgC;IAErD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IAExB,OAAO,CAAC,QAAQ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AE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IAExB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA8C;IAClF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA2C;IAC1E,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAErC;IAEF,QAAQ,CAAC,WAAW,uBAA8B;IAClD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,YAAY,CAAC;IAC9C,QAAQ,CAAC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;gBAG7C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACvC,SAAS,EAAE,wBAAwB,EACnC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACrD,gBAAgB,EAAE,MAAM,YAAY;IAclC,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC,YAAY,CAAC;YA6CnC,cAAc;IA6D5B,OAAO,CAAC,uBAAuB;CAgBlC"}
|
|
@@ -26,8 +26,6 @@ export class ScheduledAction {
|
|
|
26
26
|
this.handler = handler;
|
|
27
27
|
}
|
|
28
28
|
async exec(ctx) {
|
|
29
|
-
if (!ctx.isInitialized)
|
|
30
|
-
throw new Error(`Context for ${this.key} is not initialized or already consumed`);
|
|
31
29
|
if (!this.activeProvider(ctx) ||
|
|
32
30
|
!this.chatsWhitelistProvider(ctx).includes(ctx.chatInfo.id))
|
|
33
31
|
return Noop.NoResponse;
|
|
@@ -38,7 +36,8 @@ export class ScheduledAction {
|
|
|
38
36
|
ctx.eventEmitter.emit(BotEventType.scheduledActionExecuting, {
|
|
39
37
|
action: this,
|
|
40
38
|
ctx,
|
|
41
|
-
state
|
|
39
|
+
state,
|
|
40
|
+
traceId: ctx.traceId
|
|
42
41
|
});
|
|
43
42
|
await this.handler(ctx, (key) => this.getCachedValue(key, ctx), state);
|
|
44
43
|
state.lastExecutedDate = moment().valueOf();
|
|
@@ -46,7 +45,8 @@ export class ScheduledAction {
|
|
|
46
45
|
ctx.eventEmitter.emit(BotEventType.scheduledActionExecuted, {
|
|
47
46
|
action: this,
|
|
48
47
|
ctx,
|
|
49
|
-
state
|
|
48
|
+
state,
|
|
49
|
+
traceId: ctx.traceId
|
|
50
50
|
});
|
|
51
51
|
return ctx.responses;
|
|
52
52
|
}
|
|
@@ -62,7 +62,8 @@ export class ScheduledAction {
|
|
|
62
62
|
ctx.eventEmitter.emit(BotEventType.scheduledActionCacheValueCreating, {
|
|
63
63
|
action: this,
|
|
64
64
|
ctx,
|
|
65
|
-
key
|
|
65
|
+
key,
|
|
66
|
+
traceId: ctx.traceId
|
|
66
67
|
});
|
|
67
68
|
const value = await cachedItemFactory.getValue();
|
|
68
69
|
this.cachedState.set(key, value);
|
|
@@ -73,7 +74,8 @@ export class ScheduledAction {
|
|
|
73
74
|
ctx.eventEmitter.emit(BotEventType.scheduledActionCacheValueReturned, {
|
|
74
75
|
action: this,
|
|
75
76
|
ctx,
|
|
76
|
-
key
|
|
77
|
+
key,
|
|
78
|
+
traceId: ctx.traceId
|
|
77
79
|
});
|
|
78
80
|
semaphore.release();
|
|
79
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"botInstance.d.ts","sourceRoot":"","sources":["../../src/entities/botInstance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,O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AAC,EAAE,UAAU,CAAC;SAC1B,CAAC;KACL;IAuBK,KAAK,CACP,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QACL,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;QACxC,SAAS,EAAE,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;QAC3C,aAAa,EAAE,iBAAiB,EAAE,CAAC;KACtC,EACD,eAAe,CAAC,EAAE,OAAO;IAcvB,IAAI;CAUb"}
|
|
@@ -2,6 +2,7 @@ import { JsonFileStorage } from '../services/jsonFileStorage';
|
|
|
2
2
|
import { NodeTimeoutScheduler } from '../services/nodeTimeoutScheduler';
|
|
3
3
|
import { ActionProcessingService } from '../services/actionProcessingService';
|
|
4
4
|
import { BotEventType, TypedEventEmitter } from '../types/events';
|
|
5
|
+
import { createTrace } from '../helpers/traceFactory';
|
|
5
6
|
export class BotInstance {
|
|
6
7
|
storage;
|
|
7
8
|
scheduler;
|
|
@@ -16,21 +17,23 @@ export class BotInstance {
|
|
|
16
17
|
this.name = options.name;
|
|
17
18
|
this.scheduler =
|
|
18
19
|
options.services?.scheduler ??
|
|
19
|
-
new NodeTimeoutScheduler(this.eventEmitter);
|
|
20
|
+
new NodeTimeoutScheduler(this.eventEmitter, this.name);
|
|
20
21
|
this.storage =
|
|
21
22
|
options.services?.storageClient ??
|
|
22
|
-
new JsonFileStorage(options.name, actions,
|
|
23
|
+
new JsonFileStorage(options.name, actions, options.storagePath);
|
|
23
24
|
this.actionProcessingService = new ActionProcessingService(this.name, options.chats, this.storage, this.scheduler, this.eventEmitter);
|
|
24
25
|
}
|
|
25
26
|
async start(token, actions, scheduledPeriod) {
|
|
26
27
|
this.eventEmitter.emit(BotEventType.botStarting, {
|
|
27
|
-
botName: this.name
|
|
28
|
+
botName: this.name,
|
|
29
|
+
traceId: createTrace(this, this.name, 'startup')
|
|
28
30
|
});
|
|
29
31
|
await this.actionProcessingService.initialize(token, actions, scheduledPeriod);
|
|
30
32
|
}
|
|
31
33
|
async stop() {
|
|
32
34
|
this.eventEmitter.emit(BotEventType.botStopping, {
|
|
33
|
-
botName: this.name
|
|
35
|
+
botName: this.name,
|
|
36
|
+
traceId: createTrace(this, this.name, 'stop')
|
|
34
37
|
});
|
|
35
38
|
this.scheduler.stopAll();
|
|
36
39
|
await this.storage.close();
|
|
@@ -9,25 +9,21 @@ import { IStorageClient } from '../../types/storage';
|
|
|
9
9
|
import { TraceId } from '../../types/trace';
|
|
10
10
|
export type BaseContextPropertiesToOmit = 'action' | 'isInitialized' | 'storage' | 'scheduler' | 'eventEmitter' | 'responses' | 'traceId';
|
|
11
11
|
export declare abstract class BaseContextInternal<TAction extends IAction> {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
action: TAction;
|
|
12
|
+
readonly responses: BotResponse[];
|
|
13
|
+
readonly action: TAction;
|
|
15
14
|
/** Storage client instance for the bot executing this action. */
|
|
16
15
|
readonly storage: IStorageClient;
|
|
17
16
|
/** Scheduler instance for the bot executing this action */
|
|
18
17
|
readonly scheduler: IScheduler;
|
|
19
18
|
readonly eventEmitter: TypedEventEmitter;
|
|
20
19
|
/** Trace id of a action execution. */
|
|
21
|
-
traceId: TraceId;
|
|
20
|
+
readonly traceId: TraceId;
|
|
22
21
|
/** Name of a bot that executes this action. */
|
|
23
|
-
botName: string;
|
|
22
|
+
readonly botName: string;
|
|
24
23
|
/** Chat information. */
|
|
25
|
-
chatInfo: ChatInfo;
|
|
24
|
+
readonly chatInfo: ChatInfo;
|
|
26
25
|
get actionKey(): import("../..").ActionKey;
|
|
27
|
-
|
|
28
|
-
get responses(): BotResponse[];
|
|
29
|
-
set responses(value: BotResponse[]);
|
|
30
|
-
constructor(storage: IStorageClient, scheduler: IScheduler, eventEmitter: TypedEventEmitter);
|
|
26
|
+
constructor(storage: IStorageClient, scheduler: IScheduler, eventEmitter: TypedEventEmitter, action: TAction, chatInfo: ChatInfo, traceId: TraceId, botName: string);
|
|
31
27
|
protected createCaptureController(response: IReplyResponse): ICaptureController;
|
|
32
28
|
/**
|
|
33
29
|
* Loads state of another action for current chat.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/baseContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,MAAM,MAAM,2BAA2B,GACjC,QAAQ,GACR,eAAe,GACf,SAAS,GACT,WAAW,GACX,cAAc,GACd,WAAW,GACX,SAAS,CAAC;AAEhB,8BAAsB,mBAAmB,CAAC,OAAO,SAAS,OAAO;IAC7D,
|
|
1
|
+
{"version":3,"file":"baseContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/baseContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAA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CAAC,EAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC;CAI9D"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export class BaseContextInternal {
|
|
2
|
-
|
|
3
|
-
_responses = [];
|
|
2
|
+
responses = [];
|
|
4
3
|
action;
|
|
5
4
|
/** Storage client instance for the bot executing this action. */
|
|
6
5
|
storage;
|
|
@@ -16,17 +15,14 @@ export class BaseContextInternal {
|
|
|
16
15
|
get actionKey() {
|
|
17
16
|
return this.action.key;
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
get responses() {
|
|
21
|
-
return this._responses;
|
|
22
|
-
}
|
|
23
|
-
set responses(value) {
|
|
24
|
-
this._responses = value;
|
|
25
|
-
}
|
|
26
|
-
constructor(storage, scheduler, eventEmitter) {
|
|
18
|
+
constructor(storage, scheduler, eventEmitter, action, chatInfo, traceId, botName) {
|
|
27
19
|
this.storage = storage;
|
|
28
20
|
this.scheduler = scheduler;
|
|
29
21
|
this.eventEmitter = eventEmitter;
|
|
22
|
+
this.botName = botName;
|
|
23
|
+
this.action = action;
|
|
24
|
+
this.chatInfo = chatInfo;
|
|
25
|
+
this.traceId = traceId;
|
|
30
26
|
}
|
|
31
27
|
createCaptureController(response) {
|
|
32
28
|
return {
|
|
@@ -48,7 +44,7 @@ export class BaseContextInternal {
|
|
|
48
44
|
loadStateOf(action) {
|
|
49
45
|
const allStates = this.storage.load(action);
|
|
50
46
|
const stateForChat = allStates[this.chatInfo.id] ?? action.stateConstructor();
|
|
51
|
-
return Object.freeze(stateForChat);
|
|
47
|
+
return Object.freeze(structuredClone(stateForChat));
|
|
52
48
|
}
|
|
53
49
|
/**
|
|
54
50
|
* Mutates state of another action for current chat.
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { BotResponse } from '../../types/response';
|
|
2
1
|
import { InlineQueryAction } from '../actions/inlineQueryAction';
|
|
3
2
|
import { BaseContextInternal, BaseContextPropertiesToOmit } from './baseContext';
|
|
4
3
|
import { TelegramInlineQueryResult } from '../../types/externalAliases';
|
|
4
|
+
import { TypedEventEmitter } from '../../types/events';
|
|
5
|
+
import { IScheduler } from '../../types/scheduler';
|
|
6
|
+
import { IStorageClient } from '../../types/storage';
|
|
7
|
+
import { ChatInfo } from '../../dtos/chatInfo';
|
|
8
|
+
import { IncomingInlineQuery } from '../../dtos/incomingQuery';
|
|
5
9
|
export type InlineQueryContext = Omit<InlineQueryContextInternal, BaseContextPropertiesToOmit | 'queryResults' | 'queryId'>;
|
|
6
10
|
export declare class InlineQueryContextInternal extends BaseContextInternal<InlineQueryAction> {
|
|
7
|
-
queryResults: TelegramInlineQueryResult[];
|
|
11
|
+
readonly queryResults: TelegramInlineQueryResult[];
|
|
8
12
|
/**
|
|
9
13
|
* Abort signal to be utilized in query handler.
|
|
10
14
|
* Signal will be aborted if new query comes from the same user.
|
|
11
15
|
*/
|
|
12
|
-
abortSignal: AbortSignal;
|
|
13
|
-
/** Ordered collection of responses to be processed */
|
|
14
|
-
get responses(): BotResponse[];
|
|
16
|
+
readonly abortSignal: AbortSignal;
|
|
15
17
|
/** Inline query text */
|
|
16
|
-
queryText: string;
|
|
18
|
+
readonly queryText: string;
|
|
17
19
|
/** Internal query id */
|
|
18
|
-
queryId: string;
|
|
20
|
+
readonly queryId: string;
|
|
19
21
|
/** Collection of Regexp match results on a message that triggered this action. Will be empty if trigger is not a Regexp. */
|
|
20
22
|
matchResults: RegExpMatchArray[];
|
|
23
|
+
constructor(storage: IStorageClient, scheduler: IScheduler, eventEmitter: TypedEventEmitter, action: InlineQueryAction, query: IncomingInlineQuery, chatInfo: ChatInfo, botName: string);
|
|
21
24
|
/**
|
|
22
25
|
* This result will be shown to user as a response to inline query.
|
|
23
26
|
* @param queryResult Inline query result to be shown to user.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineQueryContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/inlineQueryContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"inlineQueryContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/inlineQueryContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACH,mBAAmB,EACnB,2BAA2B,EAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACjC,0BAA0B,EAC1B,2BAA2B,GAAG,cAAc,GAAG,SAAS,CAC3D,CAAC;AAEF,qBAAa,0BAA2B,SAAQ,mBAAmB,CAAC,iBAAiB,CAAC;IAClF,QAAQ,CAAC,YAAY,EAAE,yBAAyB,EAAE,CAAM;IACxD;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,wBAAwB;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,wBAAwB;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4HAA4H;IAC5H,YAAY,EAAE,gBAAgB,EAAE,CAAM;gBAGlC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,UAAU,EACrB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,mBAAmB,EAC1B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,MAAM;IAiBnB;;;OAGG;IACH,qBAAqB,CAAC,WAAW,EAAE,yBAAyB;CAG/D"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { InlineQueryResponse } from '../../dtos/responses/inlineQueryResponse';
|
|
2
1
|
import { BaseContextInternal } from './baseContext';
|
|
3
2
|
export class InlineQueryContextInternal extends BaseContextInternal {
|
|
4
3
|
queryResults = [];
|
|
@@ -7,18 +6,18 @@ export class InlineQueryContextInternal extends BaseContextInternal {
|
|
|
7
6
|
* Signal will be aborted if new query comes from the same user.
|
|
8
7
|
*/
|
|
9
8
|
abortSignal;
|
|
10
|
-
/** Ordered collection of responses to be processed */
|
|
11
|
-
get responses() {
|
|
12
|
-
return [
|
|
13
|
-
new InlineQueryResponse(this.queryResults, this.queryId, this.traceId, this.action)
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
9
|
/** Inline query text */
|
|
17
10
|
queryText;
|
|
18
11
|
/** Internal query id */
|
|
19
12
|
queryId;
|
|
20
13
|
/** Collection of Regexp match results on a message that triggered this action. Will be empty if trigger is not a Regexp. */
|
|
21
14
|
matchResults = [];
|
|
15
|
+
constructor(storage, scheduler, eventEmitter, action, query, chatInfo, botName) {
|
|
16
|
+
super(storage, scheduler, eventEmitter, action, chatInfo, query.traceId, botName);
|
|
17
|
+
this.queryText = query.query;
|
|
18
|
+
this.queryId = query.queryId;
|
|
19
|
+
this.abortSignal = query.abortController.signal;
|
|
20
|
+
}
|
|
22
21
|
/**
|
|
23
22
|
* This result will be shown to user as a response to inline query.
|
|
24
23
|
* @param queryResult Inline query result to be shown to user.
|
|
@@ -7,22 +7,28 @@ import { BaseContextPropertiesToOmit } from './baseContext';
|
|
|
7
7
|
import { MessageInfo } from '../../dtos/messageInfo';
|
|
8
8
|
import { UserInfo } from '../../dtos/userInfo';
|
|
9
9
|
import { BotInfo, TelegramEmoji } from '../../types/externalAliases';
|
|
10
|
+
import { TypedEventEmitter } from '../../types/events';
|
|
11
|
+
import { IScheduler } from '../../types/scheduler';
|
|
12
|
+
import { IStorageClient } from '../../types/storage';
|
|
13
|
+
import { IncomingMessage } from '../../dtos/incomingMessage';
|
|
10
14
|
export type MessageContext<TActionState extends IActionState> = Omit<MessageContextInternal<TActionState>, BaseContextPropertiesToOmit | 'startCooldown' | 'customCooldown'>;
|
|
11
15
|
/**
|
|
12
16
|
* Context of action executed in chat, in response to a message
|
|
13
17
|
*/
|
|
14
18
|
export declare class MessageContextInternal<TActionState extends IActionState> extends ChatContextInternal<TActionState, CommandAction<TActionState>> {
|
|
15
19
|
/** Information about the user that triggered this action */
|
|
16
|
-
userInfo: UserInfo;
|
|
20
|
+
readonly userInfo: UserInfo;
|
|
17
21
|
/** Information about the message that triggered this action */
|
|
18
|
-
messageInfo: MessageInfo;
|
|
19
|
-
/**
|
|
20
|
-
|
|
22
|
+
readonly messageInfo: MessageInfo;
|
|
23
|
+
/** Bot info from Telegram */
|
|
24
|
+
readonly botInfo: BotInfo;
|
|
21
25
|
/** Indicates if cooldown should be started after action is executed. Set to `true` by default. */
|
|
22
26
|
startCooldown: boolean;
|
|
23
|
-
/**
|
|
24
|
-
botInfo: BotInfo;
|
|
27
|
+
/** Custom cooldown duration in seconds, if specified. */
|
|
25
28
|
customCooldown: Seconds | undefined;
|
|
29
|
+
/** Collection of Regexp match results on a message that triggered this action. Will be empty if trigger is not a Regexp. */
|
|
30
|
+
matchResults: RegExpMatchArray[];
|
|
31
|
+
constructor(storage: IStorageClient, scheduler: IScheduler, eventEmitter: TypedEventEmitter, action: CommandAction<TActionState>, message: IncomingMessage, botName: string, botInfo: BotInfo);
|
|
26
32
|
private getQuotePart;
|
|
27
33
|
private replyWithText;
|
|
28
34
|
private replyWithImage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/messageContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAKvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACH,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QAGzD;;;;WAIG;8BACmB,aAAa;MAWrC;CACL"}
|
|
@@ -5,6 +5,8 @@ import { TextMessage } from '../../dtos/responses/textMessage';
|
|
|
5
5
|
import { VideoMessage } from '../../dtos/responses/videoMessage';
|
|
6
6
|
import { ChatContextInternal } from './chatContext';
|
|
7
7
|
import { ReplyInfo } from '../../dtos/replyInfo';
|
|
8
|
+
import { MessageInfo } from '../../dtos/messageInfo';
|
|
9
|
+
import { UserInfo } from '../../dtos/userInfo';
|
|
8
10
|
/**
|
|
9
11
|
* Context of action executed in chat, in response to a message
|
|
10
12
|
*/
|
|
@@ -13,13 +15,21 @@ export class MessageContextInternal extends ChatContextInternal {
|
|
|
13
15
|
userInfo;
|
|
14
16
|
/** Information about the message that triggered this action */
|
|
15
17
|
messageInfo;
|
|
16
|
-
/** Collection of Regexp match results on a message that triggered this action. Will be empty if trigger is not a Regexp. */
|
|
17
|
-
matchResults = [];
|
|
18
|
-
/** Indicates if cooldown should be started after action is executed. Set to `true` by default. */
|
|
19
|
-
startCooldown = true;
|
|
20
18
|
/** Bot info from Telegram */
|
|
21
19
|
botInfo;
|
|
20
|
+
/** Indicates if cooldown should be started after action is executed. Set to `true` by default. */
|
|
21
|
+
startCooldown = true;
|
|
22
|
+
/** Custom cooldown duration in seconds, if specified. */
|
|
22
23
|
customCooldown;
|
|
24
|
+
/** Collection of Regexp match results on a message that triggered this action. Will be empty if trigger is not a Regexp. */
|
|
25
|
+
matchResults = [];
|
|
26
|
+
constructor(storage, scheduler, eventEmitter, action, message, botName, botInfo) {
|
|
27
|
+
super(storage, scheduler, eventEmitter, action, message.chatInfo, message.traceId, botName);
|
|
28
|
+
this.messageInfo = new MessageInfo(message.messageId, message.text, message.type, message.updateObject);
|
|
29
|
+
this.userInfo = new UserInfo(message.from?.id ?? -1, (message.from?.first_name ?? 'Unknown user') +
|
|
30
|
+
(message.from?.last_name ? ` ${message.from.last_name}` : ''));
|
|
31
|
+
this.botInfo = botInfo;
|
|
32
|
+
}
|
|
23
33
|
getQuotePart(quote) {
|
|
24
34
|
if (typeof quote != 'boolean')
|
|
25
35
|
return quote;
|
|
@@ -4,20 +4,24 @@ import { ReplyCaptureAction } from '../actions/replyCaptureAction';
|
|
|
4
4
|
import { BaseContextInternal, BaseContextPropertiesToOmit } from './baseContext';
|
|
5
5
|
import { UserInfo } from '../../dtos/userInfo';
|
|
6
6
|
import { MessageInfo } from '../../dtos/messageInfo';
|
|
7
|
-
import { TelegramUser, TelegramEmoji } from '../../types/externalAliases';
|
|
7
|
+
import { TelegramUser, TelegramEmoji, BotInfo } from '../../types/externalAliases';
|
|
8
|
+
import { TypedEventEmitter } from '../../types/events';
|
|
9
|
+
import { IScheduler } from '../../types/scheduler';
|
|
10
|
+
import { IStorageClient } from '../../types/storage';
|
|
11
|
+
import { IncomingMessage } from '../../dtos/incomingMessage';
|
|
8
12
|
export type ReplyContext<TActionState extends IActionState> = Omit<ReplyContextInternal<TActionState>, BaseContextPropertiesToOmit | 'messageId' | 'startCooldown' | 'customCooldown'>;
|
|
9
13
|
export declare class ReplyContextInternal<TParentActionState extends IActionState> extends BaseContextInternal<ReplyCaptureAction<TParentActionState>> {
|
|
10
14
|
/** Collection of Regexp match results on a message that triggered this action. Will be empty if trigger is not a Regexp. */
|
|
11
15
|
matchResults: RegExpExecArray[];
|
|
12
16
|
/** Id of a message that triggered this action. */
|
|
13
|
-
replyMessageId: number | undefined;
|
|
17
|
+
readonly replyMessageId: number | undefined;
|
|
14
18
|
/** Information about the user that triggered this action */
|
|
15
|
-
userInfo: UserInfo;
|
|
19
|
+
readonly userInfo: UserInfo;
|
|
16
20
|
/** Information about the message that triggered this action */
|
|
17
|
-
messageInfo: MessageInfo;
|
|
21
|
+
readonly messageInfo: MessageInfo;
|
|
18
22
|
/** Bot info from Telegram */
|
|
19
|
-
botInfo: TelegramUser;
|
|
20
|
-
|
|
23
|
+
readonly botInfo: TelegramUser;
|
|
24
|
+
constructor(storage: IStorageClient, scheduler: IScheduler, eventEmitter: TypedEventEmitter, action: ReplyCaptureAction<TParentActionState>, message: IncomingMessage, botName: string, botInfo: BotInfo);
|
|
21
25
|
private getQuotePart;
|
|
22
26
|
private replyWithText;
|
|
23
27
|
private replyWithImage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replyContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/replyContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACH,yBAAyB,EACzB,qBAAqB,EACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACH,mBAAmB,EACnB,2BAA2B,EAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"replyContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/replyContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACH,yBAAyB,EACzB,qBAAqB,EACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACH,mBAAmB,EACnB,2BAA2B,EAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACH,YAAY,EACZ,aAAa,EACb,OAAO,EACV,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,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G5D;;;;;WAKG;0BACe,MAAM,YAAY,qBAAqB;QAIzD;;;;;WAKG;0BACe,MAAM,YAAY,qBAAqB;QAIzD;;;;WAIG;8BACmB,aAAa;MAWrC;CACL"}
|
|
@@ -5,9 +5,11 @@ import { TextMessage } from '../../dtos/responses/textMessage';
|
|
|
5
5
|
import { VideoMessage } from '../../dtos/responses/videoMessage';
|
|
6
6
|
import { resolve } from 'path';
|
|
7
7
|
import { BaseContextInternal } from './baseContext';
|
|
8
|
+
import { UserInfo } from '../../dtos/userInfo';
|
|
9
|
+
import { MessageInfo } from '../../dtos/messageInfo';
|
|
8
10
|
export class ReplyContextInternal extends BaseContextInternal {
|
|
9
11
|
/** Collection of Regexp match results on a message that triggered this action. Will be empty if trigger is not a Regexp. */
|
|
10
|
-
matchResults;
|
|
12
|
+
matchResults = [];
|
|
11
13
|
/** Id of a message that triggered this action. */
|
|
12
14
|
replyMessageId;
|
|
13
15
|
/** Information about the user that triggered this action */
|
|
@@ -16,7 +18,14 @@ export class ReplyContextInternal extends BaseContextInternal {
|
|
|
16
18
|
messageInfo;
|
|
17
19
|
/** Bot info from Telegram */
|
|
18
20
|
botInfo;
|
|
19
|
-
|
|
21
|
+
constructor(storage, scheduler, eventEmitter, action, message, botName, botInfo) {
|
|
22
|
+
super(storage, scheduler, eventEmitter, action, message.chatInfo, message.traceId, botName);
|
|
23
|
+
this.replyMessageId = message.replyToMessageId;
|
|
24
|
+
this.messageInfo = new MessageInfo(message.messageId, message.text, message.type, message.updateObject);
|
|
25
|
+
this.userInfo = new UserInfo(message.from?.id ?? -1, (message.from?.first_name ?? 'Unknown user') +
|
|
26
|
+
(message.from?.last_name ? ` ${message.from.last_name}` : ''));
|
|
27
|
+
this.botInfo = botInfo;
|
|
28
|
+
}
|
|
20
29
|
getQuotePart(quote) {
|
|
21
30
|
if (typeof quote != 'boolean')
|
|
22
31
|
return quote;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Milliseconds } from '../types/timeValues';
|
|
2
|
+
import { TraceId } from '../types/trace';
|
|
2
3
|
export declare class TaskRecord {
|
|
3
4
|
readonly name: string;
|
|
4
5
|
readonly taskId: NodeJS.Timeout;
|
|
5
6
|
readonly interval: Milliseconds;
|
|
6
|
-
|
|
7
|
+
readonly traceId: TraceId;
|
|
8
|
+
constructor(name: string, taskId: NodeJS.Timeout, interval: Milliseconds, traceId: TraceId);
|
|
7
9
|
}
|
|
8
10
|
//# sourceMappingURL=taskRecord.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskRecord.d.ts","sourceRoot":"","sources":["../../src/entities/taskRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"taskRecord.d.ts","sourceRoot":"","sources":["../../src/entities/taskRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,UAAU;IAEf,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO;IAC/B,QAAQ,CAAC,QAAQ,EAAE,YAAY;IAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO;gBAHhB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,OAAO,EACtB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO;CAEhC"}
|
|
@@ -2,9 +2,11 @@ export class TaskRecord {
|
|
|
2
2
|
name;
|
|
3
3
|
taskId;
|
|
4
4
|
interval;
|
|
5
|
-
|
|
5
|
+
traceId;
|
|
6
|
+
constructor(name, taskId, interval, traceId) {
|
|
6
7
|
this.name = name;
|
|
7
8
|
this.taskId = taskId;
|
|
8
9
|
this.interval = interval;
|
|
10
|
+
this.traceId = traceId;
|
|
9
11
|
}
|
|
10
12
|
}
|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,OAAO;IAqD7B,IAAI;CAGP"}
|
|
@@ -23,8 +23,8 @@ export class ActionProcessingService {
|
|
|
23
23
|
}
|
|
24
24
|
async initialize(token, actions, scheduledPeriod) {
|
|
25
25
|
this.telegramBot = new Telegraf(token);
|
|
26
|
-
const api = new TelegramApiService(this.botName, this.telegramBot.telegram, this.storage, this.eventEmitter, (capture, id, chatInfo) => {
|
|
27
|
-
this.commandProcessor.captureRegistrationCallback(capture, id, chatInfo);
|
|
26
|
+
const api = new TelegramApiService(this.botName, this.telegramBot.telegram, this.storage, this.eventEmitter, (capture, id, chatInfo, traceId) => {
|
|
27
|
+
this.commandProcessor.captureRegistrationCallback(capture, id, chatInfo, traceId);
|
|
28
28
|
});
|
|
29
29
|
const botInfo = await this.telegramBot.telegram.getMe();
|
|
30
30
|
const commandActions = actions.commands.length > 0 && botInfo.username
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseProcessor.d.ts","sourceRoot":"","sources":["../../../src/services/actionProcessors/baseProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAgB,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAErE,8BAAsB,mBAAmB;IACrC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IAC3C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IACzC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IAEnD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEnC,SAAS,CAAC,GAA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