chz-telegram-bot 0.7.6 → 0.7.8

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/index.d.ts CHANGED
@@ -23,5 +23,5 @@ export { ICaptureController } from './types/capture';
23
23
  export { ChatInfo } from './dtos/chatInfo';
24
24
  export { MessageInfo } from './dtos/messageInfo';
25
25
  export { UserInfo } from './dtos/userInfo';
26
- export { BotEventType } from './types/events';
26
+ export { BotEventType, BotEventMap as BotEventArgumentsMap } from './types/events';
27
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,6CAA6C,CAAC;AAC5D,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE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}
1
+ {"version":3,"file":"commandActionProcessor.d.ts","sourceRoot":"","sources":["../../../src/services/actionProcessors/commandActionProcessor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAIrE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAM/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAI5C,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IACxE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2C;IACvE,OAAO,CAAC,OAAO,CAAW;IAE1B,OAAO,CAAC,QAAQ,CAKd;IAEF,UAAU,CACN,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,WAAW,EACrB,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,EAAE,EACvC,OAAO,EAAE,OAAO;IAgDpB,2BAA2B,CACvB,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO;IA2CpB,OAAO,CAAC,sBAAsB;CAgGjC"}
@@ -53,14 +53,17 @@ export class CommandActionProcessor extends BaseActionProcessor {
53
53
  });
54
54
  this.replyCaptures.push(replyAction);
55
55
  capture.abortController.signal.addEventListener('abort', () => {
56
- const index = this.replyCaptures.indexOf(replyAction);
57
- this.replyCaptures.splice(index, 1);
58
- this.eventEmitter.emit(BotEventType.commandActionCaptureAborted, {
59
- parentMessageId,
60
- chatInfo,
61
- traceId
62
- });
63
- });
56
+ const capturesWithController = this.replyCaptures.filter((x) => x.abortController == capture.abortController);
57
+ for (const captureToCancel of capturesWithController) {
58
+ const index = this.replyCaptures.indexOf(captureToCancel);
59
+ this.replyCaptures.splice(index, 1);
60
+ this.eventEmitter.emit(BotEventType.commandActionCaptureAborted, {
61
+ parentMessageId,
62
+ chatInfo,
63
+ traceId
64
+ });
65
+ }
66
+ }, { once: true });
64
67
  }
65
68
  startMessageProcessing(msg) {
66
69
  this.eventEmitter.emit(BotEventType.messageProcessingStarted, {
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "type": "git",
15
15
  "url": "https://github.com/AlexSolari/botFramework.git"
16
16
  },
17
- "version": "0.7.6",
17
+ "version": "0.7.8",
18
18
  "type": "module",
19
19
  "dependencies": {
20
20
  "async-sema": "^3.1.1",
package/src/index.ts CHANGED
@@ -23,4 +23,7 @@ export { ICaptureController } from './types/capture';
23
23
  export { ChatInfo } from './dtos/chatInfo';
24
24
  export { MessageInfo } from './dtos/messageInfo';
25
25
  export { UserInfo } from './dtos/userInfo';
26
- export { BotEventType } from './types/events';
26
+ export {
27
+ BotEventType,
28
+ BotEventMap as BotEventArgumentsMap
29
+ } from './types/events';
@@ -107,16 +107,29 @@ export class CommandActionProcessor extends BaseActionProcessor {
107
107
 
108
108
  this.replyCaptures.push(replyAction);
109
109
 
110
- capture.abortController.signal.addEventListener('abort', () => {
111
- const index = this.replyCaptures.indexOf(replyAction);
112
- this.replyCaptures.splice(index, 1);
113
-
114
- this.eventEmitter.emit(BotEventType.commandActionCaptureAborted, {
115
- parentMessageId,
116
- chatInfo,
117
- traceId
118
- });
119
- });
110
+ capture.abortController.signal.addEventListener(
111
+ 'abort',
112
+ () => {
113
+ const capturesWithController = this.replyCaptures.filter(
114
+ (x) => x.abortController == capture.abortController
115
+ );
116
+
117
+ for (const captureToCancel of capturesWithController) {
118
+ const index = this.replyCaptures.indexOf(captureToCancel);
119
+ this.replyCaptures.splice(index, 1);
120
+
121
+ this.eventEmitter.emit(
122
+ BotEventType.commandActionCaptureAborted,
123
+ {
124
+ parentMessageId,
125
+ chatInfo,
126
+ traceId
127
+ }
128
+ );
129
+ }
130
+ },
131
+ { once: true }
132
+ );
120
133
  }
121
134
 
122
135
  private startMessageProcessing(msg: IncomingMessage) {