chz-telegram-bot 0.7.30 → 0.7.31
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/dtos/responses/deleteMessage.d.ts +14 -0
- package/dist/dtos/responses/deleteMessage.d.ts.map +1 -0
- package/dist/dtos/responses/deleteMessage.js +15 -0
- package/dist/dtos/responses/imageMessage.d.ts +2 -2
- package/dist/dtos/responses/imageMessage.d.ts.map +1 -1
- package/dist/dtos/responses/imageMessage.js +1 -1
- package/dist/dtos/responses/pin.d.ts +3 -4
- package/dist/dtos/responses/pin.d.ts.map +1 -1
- package/dist/dtos/responses/textMessage.d.ts +2 -2
- package/dist/dtos/responses/textMessage.d.ts.map +1 -1
- package/dist/dtos/responses/textMessage.js +1 -1
- package/dist/dtos/responses/videoMessage.d.ts +2 -2
- package/dist/dtos/responses/videoMessage.d.ts.map +1 -1
- package/dist/dtos/responses/videoMessage.js +1 -1
- package/dist/entities/context/baseContext.d.ts +2 -2
- package/dist/entities/context/baseContext.d.ts.map +1 -1
- package/dist/entities/context/baseContext.js +14 -2
- package/dist/entities/context/chatContext.d.ts +3 -3
- package/dist/entities/context/chatContext.js +3 -3
- package/dist/entities/context/messageContext.d.ts +6 -6
- package/dist/entities/context/messageContext.js +3 -3
- package/dist/entities/context/replyContext.d.ts +6 -6
- package/dist/entities/context/replyContext.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/services/actionProcessors/commandActionProcessor.d.ts +2 -2
- package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +1 -1
- package/dist/services/telegramApi.d.ts +2 -2
- package/dist/services/telegramApi.d.ts.map +1 -1
- package/dist/services/telegramApi.js +25 -5
- package/dist/types/postSendOperations.d.ts +39 -0
- package/dist/types/postSendOperations.d.ts.map +1 -0
- package/dist/types/postSendOperations.js +1 -0
- package/dist/types/response.d.ts +5 -3
- package/dist/types/response.d.ts.map +1 -1
- package/dist/types/response.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IAction } from '../../types/action';
|
|
2
|
+
import { IChatResponse } from '../../types/response';
|
|
3
|
+
import { TraceId } from '../../types/trace';
|
|
4
|
+
import { ChatInfo } from '../chatInfo';
|
|
5
|
+
export declare class DeleteMessageResponse implements IChatResponse {
|
|
6
|
+
readonly kind: "deleteMessage";
|
|
7
|
+
readonly createdAt: number;
|
|
8
|
+
readonly messageId: number;
|
|
9
|
+
readonly chatInfo: ChatInfo;
|
|
10
|
+
readonly traceId: TraceId;
|
|
11
|
+
readonly action: IAction;
|
|
12
|
+
constructor(messageId: number, chatInfo: ChatInfo, traceId: TraceId, action: IAction);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=deleteMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteMessage.d.ts","sourceRoot":"","sources":["../../../src/dtos/responses/deleteMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBAAa,qBAAsB,YAAW,aAAa;IACvD,QAAQ,CAAC,IAAI,kBAAkC;IAC/C,QAAQ,CAAC,SAAS,SAAc;IAEhC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO;CAOtB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BotResponseTypes } from '../../types/response';
|
|
2
|
+
export class DeleteMessageResponse {
|
|
3
|
+
kind = BotResponseTypes.deleteMessage;
|
|
4
|
+
createdAt = Date.now();
|
|
5
|
+
messageId;
|
|
6
|
+
chatInfo;
|
|
7
|
+
traceId;
|
|
8
|
+
action;
|
|
9
|
+
constructor(messageId, chatInfo, traceId, action) {
|
|
10
|
+
this.messageId = messageId;
|
|
11
|
+
this.chatInfo = chatInfo;
|
|
12
|
+
this.traceId = traceId;
|
|
13
|
+
this.action = action;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -3,12 +3,12 @@ import { IAction } from '../../types/action';
|
|
|
3
3
|
import { ChatInfo } from '../chatInfo';
|
|
4
4
|
import { TraceId } from '../../types/trace';
|
|
5
5
|
import { ReplyInfo } from '../replyInfo';
|
|
6
|
-
import {
|
|
6
|
+
import { PostSendOperation } from '../../types/postSendOperations';
|
|
7
7
|
import { InputFile } from '../../types/inputFile';
|
|
8
8
|
export declare class ImageMessage implements IReplyResponseWithContent<InputFile> {
|
|
9
9
|
readonly kind: "image";
|
|
10
10
|
readonly createdAt: number;
|
|
11
|
-
readonly
|
|
11
|
+
readonly postSendOperations: PostSendOperation[];
|
|
12
12
|
readonly content: InputFile;
|
|
13
13
|
readonly chatInfo: ChatInfo;
|
|
14
14
|
readonly replyInfo: ReplyInfo | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageMessage.d.ts","sourceRoot":"","sources":["../../../src/dtos/responses/imageMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"imageMessage.d.ts","sourceRoot":"","sources":["../../../src/dtos/responses/imageMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,YAAa,YAAW,yBAAyB,CAAC,SAAS,CAAC;IACrE,QAAQ,CAAC,IAAI,UAA0B;IACvC,QAAQ,CAAC,SAAS,SAAc;IAChC,QAAQ,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,CAAM;IAEtD,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,SAAS;IACnC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGrB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,SAAS,CAAC,EAAE,SAAS;IASzB,IAAI,cAAc,iBAQjB;CACJ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IChatResponse } from '../../types/response';
|
|
2
|
-
import {
|
|
3
|
-
import { IActionState } from '../../types/actionState';
|
|
2
|
+
import { IAction } from '../../types/action';
|
|
4
3
|
import { ChatInfo } from '../chatInfo';
|
|
5
4
|
import { TraceId } from '../../types/trace';
|
|
6
5
|
export declare class PinResponse implements IChatResponse {
|
|
@@ -9,7 +8,7 @@ export declare class PinResponse implements IChatResponse {
|
|
|
9
8
|
readonly messageId: number;
|
|
10
9
|
readonly chatInfo: ChatInfo;
|
|
11
10
|
readonly traceId: TraceId;
|
|
12
|
-
readonly action:
|
|
13
|
-
constructor(messageId: number, chatInfo: ChatInfo, traceId: TraceId, action:
|
|
11
|
+
readonly action: IAction;
|
|
12
|
+
constructor(messageId: number, chatInfo: ChatInfo, traceId: TraceId, action: IAction);
|
|
14
13
|
}
|
|
15
14
|
//# sourceMappingURL=pin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../../../src/dtos/responses/pin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../../../src/dtos/responses/pin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,qBAAa,WAAY,YAAW,aAAa;IAC7C,QAAQ,CAAC,IAAI,QAAwB;IACrC,QAAQ,CAAC,SAAS,SAAc;IAEhC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO;CAOtB"}
|
|
@@ -4,12 +4,12 @@ import { IAction } from '../../types/action';
|
|
|
4
4
|
import { ChatInfo } from '../chatInfo';
|
|
5
5
|
import { TraceId } from '../../types/trace';
|
|
6
6
|
import { ReplyInfo } from '../replyInfo';
|
|
7
|
-
import {
|
|
7
|
+
import { PostSendOperation } from '../../types/postSendOperations';
|
|
8
8
|
import { TelegramInlineKeyboardButton } from '../../types/externalAliases';
|
|
9
9
|
export declare class TextMessage implements IReplyResponseWithContent<string> {
|
|
10
10
|
readonly kind: "text";
|
|
11
11
|
readonly createdAt: number;
|
|
12
|
-
readonly
|
|
12
|
+
readonly postSendOperations: PostSendOperation[];
|
|
13
13
|
readonly content: string;
|
|
14
14
|
readonly chatInfo: ChatInfo;
|
|
15
15
|
readonly replyInfo: ReplyInfo | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textMessage.d.ts","sourceRoot":"","sources":["../../../src/dtos/responses/textMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"textMessage.d.ts","sourceRoot":"","sources":["../../../src/dtos/responses/textMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAE3E,qBAAa,WAAY,YAAW,yBAAyB,CAAC,MAAM,CAAC;IACjE,QAAQ,CAAC,IAAI,SAAyB;IACtC,QAAQ,CAAC,SAAS,SAAc;IAChC,QAAQ,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,CAAM;IAEtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,4BAA4B,EAAE,EAAE,CAAC;gBAGjD,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,SAAS,CAAC,EAAE,SAAS,EACrB,OAAO,CAAC,EAAE,yBAAyB;IAYvC,IAAI,cAAc,gBASjB;CACJ"}
|
|
@@ -3,12 +3,12 @@ import { IAction } from '../../types/action';
|
|
|
3
3
|
import { ChatInfo } from '../chatInfo';
|
|
4
4
|
import { TraceId } from '../../types/trace';
|
|
5
5
|
import { ReplyInfo } from '../replyInfo';
|
|
6
|
-
import {
|
|
6
|
+
import { PostSendOperation } from '../../types/postSendOperations';
|
|
7
7
|
import { InputFile } from '../../types/inputFile';
|
|
8
8
|
export declare class VideoMessage implements IReplyResponseWithContent<InputFile> {
|
|
9
9
|
readonly kind: "video";
|
|
10
10
|
readonly createdAt: number;
|
|
11
|
-
readonly
|
|
11
|
+
readonly postSendOperations: PostSendOperation[];
|
|
12
12
|
readonly content: InputFile;
|
|
13
13
|
readonly chatInfo: ChatInfo;
|
|
14
14
|
readonly replyInfo: ReplyInfo | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"videoMessage.d.ts","sourceRoot":"","sources":["../../../src/dtos/responses/videoMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"videoMessage.d.ts","sourceRoot":"","sources":["../../../src/dtos/responses/videoMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,YAAa,YAAW,yBAAyB,CAAC,SAAS,CAAC;IACrE,QAAQ,CAAC,IAAI,UAA0B;IACvC,QAAQ,CAAC,SAAS,SAAc;IAChC,QAAQ,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,CAAM;IAEtD,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,SAAS;IACnC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGrB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,SAAS,CAAC,EAAE,SAAS;IASzB,IAAI,cAAc,iBAQjB;CACJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChatInfo } from '../../dtos/chatInfo';
|
|
2
2
|
import { IAction, IActionWithState } from '../../types/action';
|
|
3
3
|
import { IActionState } from '../../types/actionState';
|
|
4
|
-
import { ICaptureController } from '../../types/capture';
|
|
5
4
|
import { TypedEventEmitter } from '../../types/events';
|
|
5
|
+
import { IPostSendOperationController } from '../../types/postSendOperations';
|
|
6
6
|
import { BotResponse, IReplyResponse } from '../../types/response';
|
|
7
7
|
import { IScheduler } from '../../types/scheduler';
|
|
8
8
|
import { IStorageClient } from '../../types/storage';
|
|
@@ -27,7 +27,7 @@ export declare abstract class BaseContextInternal<TAction extends IAction> {
|
|
|
27
27
|
};
|
|
28
28
|
get actionKey(): import("../..").ActionKey;
|
|
29
29
|
constructor(storage: IStorageClient, scheduler: IScheduler, eventEmitter: TypedEventEmitter, action: TAction, chatInfo: ChatInfo, traceId: TraceId, botName: string);
|
|
30
|
-
protected
|
|
30
|
+
protected createPostSendOperationController(response: IReplyResponse): IPostSendOperationController;
|
|
31
31
|
/**
|
|
32
32
|
* Loads state of another action for current chat.
|
|
33
33
|
* @param action Action to load state of.
|
|
@@ -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;
|
|
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;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,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;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,MAAM,MAAM,2BAA2B,GACjC,QAAQ,GACR,eAAe,GACf,SAAS,GACT,WAAW,GACX,WAAW,CAAC;AAElB,8BAAsB,mBAAmB,CAAC,OAAO,SAAS,OAAO;IAC7D,QAAQ,CAAC,SAAS,EAAE,WAAW,EAAE,CAAM;IACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wBAAwB;IACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAE5B,QAAQ,CAAC,aAAa,EAAE;QACpB,qEAAqE;QACrE,YAAY,EAAE,iBAAiB,CAAC;QAChC,sCAAsC;QACtC,OAAO,EAAE,OAAO,CAAC;KACpB,CAAC;IAEF,IAAI,SAAS,8BAEZ;gBAGG,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,UAAU,EACrB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM;IAanB,SAAS,CAAC,iCAAiC,CACvC,QAAQ,EAAE,cAAc,GACzB,4BAA4B;IA+B/B;;;;OAIG;IACH,WAAW,CAAC,mBAAmB,SAAS,YAAY,EAChD,MAAM,EAAE,gBAAgB,CAAC,mBAAmB,CAAC;IAWjD;;;;;OAKG;IACG,aAAa,CAAC,mBAAmB,SAAS,YAAY,EACxD,MAAM,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,EAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,OAAO,CAAC,IAAI,CAAC;CAI9D"}
|
|
@@ -24,15 +24,27 @@ export class BaseContextInternal {
|
|
|
24
24
|
traceId
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
createPostSendOperationController(response) {
|
|
28
28
|
return {
|
|
29
29
|
captureReplies: (trigger, handler, abortController) => {
|
|
30
|
-
response.
|
|
30
|
+
response.postSendOperations.push({
|
|
31
|
+
kind: 'captureReplies',
|
|
31
32
|
trigger,
|
|
32
33
|
handler,
|
|
33
34
|
abortController: abortController ?? new AbortController(),
|
|
34
35
|
action: this.action
|
|
35
36
|
});
|
|
37
|
+
},
|
|
38
|
+
pin: () => {
|
|
39
|
+
response.postSendOperations.push({
|
|
40
|
+
kind: 'pin'
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
deleteAfter: (timeout) => {
|
|
44
|
+
response.postSendOperations.push({
|
|
45
|
+
kind: 'deleteAfterTimeout',
|
|
46
|
+
timeout: timeout
|
|
47
|
+
});
|
|
36
48
|
}
|
|
37
49
|
};
|
|
38
50
|
}
|
|
@@ -19,21 +19,21 @@ export declare class ChatContextInternal<TActionState extends IActionState, TAct
|
|
|
19
19
|
* @param text Message contents.
|
|
20
20
|
* @param options Message sending option.
|
|
21
21
|
*/
|
|
22
|
-
text: (text: string, options?: TextMessageSendingOptions) => import("../..").
|
|
22
|
+
text: (text: string, options?: TextMessageSendingOptions) => import("../..").IPostSendOperationController;
|
|
23
23
|
/**
|
|
24
24
|
* Sends image message to chat after action execution is finished.
|
|
25
25
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
26
26
|
* @param name Message contents.
|
|
27
27
|
* @param options Message sending option.
|
|
28
28
|
*/
|
|
29
|
-
image: (name: string) => import("../..").
|
|
29
|
+
image: (name: string) => import("../..").IPostSendOperationController;
|
|
30
30
|
/**
|
|
31
31
|
* Sends video/gif message to chat after action execution is finished.
|
|
32
32
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
33
33
|
* @param name Message contents.
|
|
34
34
|
* @param options Message sending option.
|
|
35
35
|
*/
|
|
36
|
-
video: (name: string) => import("../..").
|
|
36
|
+
video: (name: string) => import("../..").IPostSendOperationController;
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
39
39
|
* Unpins message after action execution is finished.
|
|
@@ -23,7 +23,7 @@ export class ChatContextInternal extends BaseContextInternal {
|
|
|
23
23
|
text: (text, options) => {
|
|
24
24
|
const response = new TextMessage(text, this.chatInfo, this.observability.traceId, this.action, undefined, options);
|
|
25
25
|
this.responses.push(response);
|
|
26
|
-
return this.
|
|
26
|
+
return this.createPostSendOperationController(response);
|
|
27
27
|
},
|
|
28
28
|
/**
|
|
29
29
|
* Sends image message to chat after action execution is finished.
|
|
@@ -34,7 +34,7 @@ export class ChatContextInternal extends BaseContextInternal {
|
|
|
34
34
|
image: (name) => {
|
|
35
35
|
const response = new ImageMessage({ source: resolve(`./content/${name}.png`) }, this.chatInfo, this.observability.traceId, this.action);
|
|
36
36
|
this.responses.push(response);
|
|
37
|
-
return this.
|
|
37
|
+
return this.createPostSendOperationController(response);
|
|
38
38
|
},
|
|
39
39
|
/**
|
|
40
40
|
* Sends video/gif message to chat after action execution is finished.
|
|
@@ -45,7 +45,7 @@ export class ChatContextInternal extends BaseContextInternal {
|
|
|
45
45
|
video: (name) => {
|
|
46
46
|
const response = new VideoMessage({ source: resolve(`./content/${name}.mp4`) }, this.chatInfo, this.observability.traceId, this.action);
|
|
47
47
|
this.responses.push(response);
|
|
48
|
-
return this.
|
|
48
|
+
return this.createPostSendOperationController(response);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
/**
|
|
@@ -49,21 +49,21 @@ export declare class MessageContextInternal<TActionState extends IActionState> e
|
|
|
49
49
|
* @param text Message contents.
|
|
50
50
|
* @param options Message sending option.
|
|
51
51
|
*/
|
|
52
|
-
withText: (text: string, quote?: string, options?: TextMessageSendingOptions) => import("../..").
|
|
52
|
+
withText: (text: string, quote?: string, options?: TextMessageSendingOptions) => import("../..").IPostSendOperationController;
|
|
53
53
|
/**
|
|
54
54
|
* Reply with image message to message that triggered this action after action execution is finished.
|
|
55
55
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
56
56
|
* @param text Message contents.
|
|
57
57
|
* @param options Message sending option.
|
|
58
58
|
*/
|
|
59
|
-
withImage: (name: string, quote?: string) => import("../..").
|
|
59
|
+
withImage: (name: string, quote?: string) => import("../..").IPostSendOperationController;
|
|
60
60
|
/**
|
|
61
61
|
* Reply with video/gif message to message that triggered this action after action execution is finished.
|
|
62
62
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
63
63
|
* @param text Message contents.
|
|
64
64
|
* @param options Message sending option.
|
|
65
65
|
*/
|
|
66
|
-
withVideo: (name: string, quote?: string) => import("../..").
|
|
66
|
+
withVideo: (name: string, quote?: string) => import("../..").IPostSendOperationController;
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
69
69
|
* Reply with text message to message that triggered this action after action execution is finished.
|
|
@@ -71,21 +71,21 @@ export declare class MessageContextInternal<TActionState extends IActionState> e
|
|
|
71
71
|
* @param text Message contents.
|
|
72
72
|
* @param options Message sending option.
|
|
73
73
|
*/
|
|
74
|
-
withText: (text: string, options?: TextMessageSendingOptions) => import("../..").
|
|
74
|
+
withText: (text: string, options?: TextMessageSendingOptions) => import("../..").IPostSendOperationController;
|
|
75
75
|
/**
|
|
76
76
|
* Reply with image message to message that triggered this action after action execution is finished.
|
|
77
77
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
78
78
|
* @param text Message contents.
|
|
79
79
|
* @param options Message sending option.
|
|
80
80
|
*/
|
|
81
|
-
withImage: (name: string) => import("../..").
|
|
81
|
+
withImage: (name: string) => import("../..").IPostSendOperationController;
|
|
82
82
|
/**
|
|
83
83
|
* Reply with video/gif message to message that triggered this action after action execution is finished.
|
|
84
84
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
85
85
|
* @param text Message contents.
|
|
86
86
|
* @param options Message sending option.
|
|
87
87
|
*/
|
|
88
|
-
withVideo: (name: string) => import("../..").
|
|
88
|
+
withVideo: (name: string) => import("../..").IPostSendOperationController;
|
|
89
89
|
/**
|
|
90
90
|
* React to the message that triggered this action after action execution is finished.
|
|
91
91
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
@@ -37,19 +37,19 @@ export class MessageContextInternal extends ChatContextInternal {
|
|
|
37
37
|
const quotedPart = getQuotedText(this, quote);
|
|
38
38
|
const response = new TextMessage(text, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined), options);
|
|
39
39
|
this.responses.push(response);
|
|
40
|
-
return this.
|
|
40
|
+
return this.createPostSendOperationController(response);
|
|
41
41
|
}
|
|
42
42
|
replyWithImage(name, quote) {
|
|
43
43
|
const quotedPart = getQuotedText(this, quote);
|
|
44
44
|
const response = new ImageMessage({ source: resolve(`./content/${name}.png`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined));
|
|
45
45
|
this.responses.push(response);
|
|
46
|
-
return this.
|
|
46
|
+
return this.createPostSendOperationController(response);
|
|
47
47
|
}
|
|
48
48
|
replyWithVideo(name, quote) {
|
|
49
49
|
const quotedPart = getQuotedText(this, quote);
|
|
50
50
|
const response = new VideoMessage({ source: resolve(`./content/${name}.mp4`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined));
|
|
51
51
|
this.responses.push(response);
|
|
52
|
-
return this.
|
|
52
|
+
return this.createPostSendOperationController(response);
|
|
53
53
|
}
|
|
54
54
|
skipCooldown() {
|
|
55
55
|
this.startCooldown = false;
|
|
@@ -44,21 +44,21 @@ export declare class ReplyContextInternal<TParentActionState extends IActionStat
|
|
|
44
44
|
* @param text Message contents.
|
|
45
45
|
* @param options Message sending option.
|
|
46
46
|
*/
|
|
47
|
-
withText: (text: string, quote?: string, options?: TextMessageSendingOptions) => import("../..").
|
|
47
|
+
withText: (text: string, quote?: string, options?: TextMessageSendingOptions) => import("../..").IPostSendOperationController;
|
|
48
48
|
/**
|
|
49
49
|
* Reply with image message to message that triggered this action after action execution is finished.
|
|
50
50
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
51
51
|
* @param text Message contents.
|
|
52
52
|
* @param options Message sending option.
|
|
53
53
|
*/
|
|
54
|
-
withImage: (name: string, quote?: string) => import("../..").
|
|
54
|
+
withImage: (name: string, quote?: string) => import("../..").IPostSendOperationController;
|
|
55
55
|
/**
|
|
56
56
|
* Reply with video/gif message to message that triggered this action after action execution is finished.
|
|
57
57
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
58
58
|
* @param text Message contents.
|
|
59
59
|
* @param options Message sending option.
|
|
60
60
|
*/
|
|
61
|
-
withVideo: (name: string, quote?: string) => import("../..").
|
|
61
|
+
withVideo: (name: string, quote?: string) => import("../..").IPostSendOperationController;
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
64
|
* Reply with text message to message that triggered this action after action execution is finished.
|
|
@@ -66,21 +66,21 @@ export declare class ReplyContextInternal<TParentActionState extends IActionStat
|
|
|
66
66
|
* @param text Message contents.
|
|
67
67
|
* @param options Message sending option.
|
|
68
68
|
*/
|
|
69
|
-
withText: (text: string, options?: TextMessageSendingOptions) => import("../..").
|
|
69
|
+
withText: (text: string, options?: TextMessageSendingOptions) => import("../..").IPostSendOperationController;
|
|
70
70
|
/**
|
|
71
71
|
* Reply with image message to message that triggered this action after action execution is finished.
|
|
72
72
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
73
73
|
* @param text Message contents.
|
|
74
74
|
* @param options Message sending option.
|
|
75
75
|
*/
|
|
76
|
-
withImage: (name: string) => import("../..").
|
|
76
|
+
withImage: (name: string) => import("../..").IPostSendOperationController;
|
|
77
77
|
/**
|
|
78
78
|
* Reply with video/gif message to message that triggered this action after action execution is finished.
|
|
79
79
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
80
80
|
* @param text Message contents.
|
|
81
81
|
* @param options Message sending option.
|
|
82
82
|
*/
|
|
83
|
-
withVideo: (name: string) => import("../..").
|
|
83
|
+
withVideo: (name: string) => import("../..").IPostSendOperationController;
|
|
84
84
|
/**
|
|
85
85
|
* React to the message that triggered this action after action execution is finished.
|
|
86
86
|
* If multiple responses are sent, they will be sent in the order they were added, with delay of at least 35ms as per Telegram rate-limit.
|
|
@@ -33,19 +33,19 @@ export class ReplyContextInternal extends BaseContextInternal {
|
|
|
33
33
|
const quotedPart = getQuotedText(this, quote);
|
|
34
34
|
const response = new TextMessage(text, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined), options);
|
|
35
35
|
this.responses.push(response);
|
|
36
|
-
return this.
|
|
36
|
+
return this.createPostSendOperationController(response);
|
|
37
37
|
}
|
|
38
38
|
replyWithImage(name, quote) {
|
|
39
39
|
const quotedPart = getQuotedText(this, quote);
|
|
40
40
|
const response = new ImageMessage({ source: resolve(`./content/${name}.png`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined));
|
|
41
41
|
this.responses.push(response);
|
|
42
|
-
return this.
|
|
42
|
+
return this.createPostSendOperationController(response);
|
|
43
43
|
}
|
|
44
44
|
replyWithVideo(name, quote) {
|
|
45
45
|
const quotedPart = getQuotedText(this, quote);
|
|
46
46
|
const response = new VideoMessage({ source: resolve(`./content/${name}.mp4`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined));
|
|
47
47
|
this.responses.push(response);
|
|
48
|
-
return this.
|
|
48
|
+
return this.createPostSendOperationController(response);
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Stops capturing replies and removes this action
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './types/action';
|
|
|
10
10
|
export * from './types/externalAliases';
|
|
11
11
|
export * from './types/storage';
|
|
12
12
|
export * from './types/scheduler';
|
|
13
|
+
export * from './types/postSendOperations';
|
|
13
14
|
export { CommandAction } from './entities/actions/commandAction';
|
|
14
15
|
export { InlineQueryAction } from './entities/actions/inlineQueryAction';
|
|
15
16
|
export { ReplyCaptureAction } from './entities/actions/replyCaptureAction';
|
|
@@ -19,7 +20,6 @@ export { ChatContext } from './entities/context/chatContext';
|
|
|
19
20
|
export { InlineQueryContext } from './entities/context/inlineQueryContext';
|
|
20
21
|
export { MessageContext } from './entities/context/messageContext';
|
|
21
22
|
export { ReplyContext } from './entities/context/replyContext';
|
|
22
|
-
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';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,
|
|
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,cAAc,4BAA4B,CAAC;AAC3C,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,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACH,YAAY,EACZ,WAAW,IAAI,oBAAoB,EACnC,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from './types/action';
|
|
|
10
10
|
export * from './types/externalAliases';
|
|
11
11
|
export * from './types/storage';
|
|
12
12
|
export * from './types/scheduler';
|
|
13
|
+
export * from './types/postSendOperations';
|
|
13
14
|
export { CommandAction } from './entities/actions/commandAction';
|
|
14
15
|
export { InlineQueryAction } from './entities/actions/inlineQueryAction';
|
|
15
16
|
export { ReplyCaptureAction } from './entities/actions/replyCaptureAction';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CommandAction } from '../../entities/actions/commandAction';
|
|
2
2
|
import { IActionState } from '../../types/actionState';
|
|
3
3
|
import { TelegramApiService } from '../telegramApi';
|
|
4
|
-
import { IReplyCapture } from '../../types/capture';
|
|
5
4
|
import { ChatInfo } from '../../dtos/chatInfo';
|
|
6
5
|
import { BaseActionProcessor } from './baseProcessor';
|
|
7
6
|
import { BotInfo, TelegramBot } from '../../types/externalAliases';
|
|
8
7
|
import { TraceId } from '../../types/trace';
|
|
8
|
+
import { ReplyCapture } from '../../types/postSendOperations';
|
|
9
9
|
export declare class CommandActionProcessor extends BaseActionProcessor {
|
|
10
10
|
private static readonly fallbackFactory;
|
|
11
11
|
private readonly replyCaptures;
|
|
@@ -13,7 +13,7 @@ export declare class CommandActionProcessor extends BaseActionProcessor {
|
|
|
13
13
|
private botInfo;
|
|
14
14
|
private commands;
|
|
15
15
|
initialize(api: TelegramApiService, telegram: TelegramBot, commands: CommandAction<IActionState>[], botInfo: BotInfo): void;
|
|
16
|
-
captureRegistrationCallback(capture:
|
|
16
|
+
captureRegistrationCallback(capture: ReplyCapture, parentMessageId: number, chatInfo: ChatInfo, traceId: TraceId): void;
|
|
17
17
|
private updateChatHistory;
|
|
18
18
|
private processCommand;
|
|
19
19
|
private processReply;
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,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;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC3D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAC1B;IAEb,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;IAoDpB,2BAA2B,CACvB,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO;IA2CpB,OAAO,CAAC,iBAAiB;YAuBX,cAAc;YA2Bd,YAAY;YA2BZ,sBAAsB;CAkCvC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IStorageClient } from '../types/storage';
|
|
2
2
|
import { BotResponse } from '../types/response';
|
|
3
|
-
import {
|
|
3
|
+
import { ReplyCapture } from '../types/postSendOperations';
|
|
4
4
|
import { TraceId } from '../types/trace';
|
|
5
5
|
import { ChatInfo } from '../dtos/chatInfo';
|
|
6
6
|
import { TelegramApiClient } from '../types/externalAliases';
|
|
@@ -13,7 +13,7 @@ export declare class TelegramApiService {
|
|
|
13
13
|
private readonly captureRegistrationCallback;
|
|
14
14
|
private readonly TELEGRAM_API_SERVICE_ERROR_TRACEID;
|
|
15
15
|
private readonly methodMap;
|
|
16
|
-
constructor(botName: string, telegram: TelegramApiClient, storage: IStorageClient, eventEmitter: TypedEventEmitter, captureRegistrationCallback: (capture:
|
|
16
|
+
constructor(botName: string, telegram: TelegramApiClient, storage: IStorageClient, eventEmitter: TypedEventEmitter, captureRegistrationCallback: (capture: ReplyCapture, parentMessageId: number, chatInfo: ChatInfo, traceId: TraceId) => void);
|
|
17
17
|
enqueueBatchedResponses(responses: BotResponse[]): void;
|
|
18
18
|
flushResponses(): void;
|
|
19
19
|
private processResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telegramApi.d.ts","sourceRoot":"","sources":["../../src/services/telegramApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"telegramApi.d.ts","sourceRoot":"","sources":["../../src/services/telegramApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAmB,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAgB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AASlE,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,YAAY,CAAoB;IACjD,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAKlC;IAEV,OAAO,CAAC,QAAQ,CAAC,kCAAkC,CAAU;IAE7D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAaxB;gBAGE,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,iBAAiB,EAC/B,2BAA2B,EAAE,CACzB,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,KACf,IAAI;IAcb,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE;IA4DhD,cAAc;YAYA,eAAe;YAwCf,cAAc;CA6H/B"}
|
|
@@ -2,6 +2,9 @@ import { ResponseProcessingQueue } from './responseProcessingQueue';
|
|
|
2
2
|
import { BotEventType } from '../types/events';
|
|
3
3
|
import { createTrace } from '../helpers/traceFactory';
|
|
4
4
|
import { TELEGRAM_ERROR_QUOTE_INVALID } from '../helpers/constants';
|
|
5
|
+
import { setTimeout } from 'timers/promises';
|
|
6
|
+
import { DeleteMessageResponse } from '../dtos/responses/deleteMessage';
|
|
7
|
+
import { PinResponse } from '../dtos/responses/pin';
|
|
5
8
|
export class TelegramApiService {
|
|
6
9
|
queue = new ResponseProcessingQueue();
|
|
7
10
|
telegram;
|
|
@@ -17,6 +20,7 @@ export class TelegramApiService {
|
|
|
17
20
|
pin: 'pinChatMessage',
|
|
18
21
|
image: 'sendPhoto',
|
|
19
22
|
video: 'sendVideo',
|
|
23
|
+
deleteMessage: 'deleteMessage',
|
|
20
24
|
delay: null
|
|
21
25
|
};
|
|
22
26
|
constructor(botName, telegram, storage, eventEmitter, captureRegistrationCallback) {
|
|
@@ -87,8 +91,19 @@ export class TelegramApiService {
|
|
|
87
91
|
async processResponse(response) {
|
|
88
92
|
const sentMessage = await this.sendApiRequest(response);
|
|
89
93
|
if (sentMessage && 'content' in response) {
|
|
90
|
-
for (const
|
|
91
|
-
|
|
94
|
+
for (const operation of response.postSendOperations) {
|
|
95
|
+
switch (operation.kind) {
|
|
96
|
+
case 'captureReplies':
|
|
97
|
+
this.captureRegistrationCallback(operation, sentMessage.message_id, response.chatInfo, response.traceId);
|
|
98
|
+
break;
|
|
99
|
+
case 'deleteAfterTimeout':
|
|
100
|
+
await setTimeout(operation.timeout);
|
|
101
|
+
await this.sendApiRequest(new DeleteMessageResponse(sentMessage.message_id, response.chatInfo, response.traceId, response.action));
|
|
102
|
+
break;
|
|
103
|
+
case 'pin':
|
|
104
|
+
await this.sendApiRequest(new PinResponse(sentMessage.message_id, response.chatInfo, response.traceId, response.action));
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
92
107
|
}
|
|
93
108
|
}
|
|
94
109
|
}
|
|
@@ -144,13 +159,18 @@ export class TelegramApiService {
|
|
|
144
159
|
return null;
|
|
145
160
|
case 'pin':
|
|
146
161
|
await this.telegram.pinChatMessage(response.chatInfo.id, response.messageId, { disable_notification: true });
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
162
|
+
if ('stateConstructor' in response.action) {
|
|
163
|
+
await this.storage.updateStateFor(response.action, response.chatInfo.id, (state) => {
|
|
164
|
+
state.pinnedMessages.push(response.messageId);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
150
167
|
return null;
|
|
151
168
|
case 'inlineQuery':
|
|
152
169
|
await this.telegram.answerInlineQuery(response.queryId, response.queryResults, { cache_time: 0 });
|
|
153
170
|
return null;
|
|
171
|
+
case 'deleteMessage':
|
|
172
|
+
await this.telegram.deleteMessage(response.chatInfo.id, response.messageId);
|
|
173
|
+
return null;
|
|
154
174
|
case 'delay':
|
|
155
175
|
return null;
|
|
156
176
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReplyContext, ReplyContextInternal } from '../entities/context/replyContext';
|
|
2
|
+
import { IAction } from './action';
|
|
3
|
+
import { IActionState } from './actionState';
|
|
4
|
+
import { CommandTrigger } from './commandTrigger';
|
|
5
|
+
import { Milliseconds } from './timeValues';
|
|
6
|
+
export interface IPostSendOperationController {
|
|
7
|
+
/**
|
|
8
|
+
* Captures replies based on the specified trigger and handler.
|
|
9
|
+
* @param trigger Array of command triggers that will activate the handler.
|
|
10
|
+
* @param handler Callback function that will be called when a trigger is matched.
|
|
11
|
+
* @param abortController Optional abort controller to manually abort capturing.
|
|
12
|
+
*/
|
|
13
|
+
captureReplies: <TParentActionState extends IActionState>(trigger: CommandTrigger[], handler: (replyContext: ReplyContext<TParentActionState>) => Promise<void>, abortController?: AbortController) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Pins the message associated with this response.
|
|
16
|
+
*/
|
|
17
|
+
pin: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* Deletes the message associated with this response after the specified timeout.
|
|
20
|
+
* @param timeout Time in milliseconds after which the message will be deleted.
|
|
21
|
+
*/
|
|
22
|
+
deleteAfter: (timeout: number) => void;
|
|
23
|
+
}
|
|
24
|
+
export type PostSendOperation = DeleteAfterTimeout | ReplyCapture | Pin;
|
|
25
|
+
export type Pin = {
|
|
26
|
+
kind: 'pin';
|
|
27
|
+
};
|
|
28
|
+
export type DeleteAfterTimeout = {
|
|
29
|
+
kind: 'deleteAfterTimeout';
|
|
30
|
+
timeout: Milliseconds;
|
|
31
|
+
};
|
|
32
|
+
export type ReplyCapture = {
|
|
33
|
+
kind: 'captureReplies';
|
|
34
|
+
trigger: CommandTrigger[];
|
|
35
|
+
handler: (replyContext: ReplyContextInternal<IActionState>) => Promise<void>;
|
|
36
|
+
abortController: AbortController;
|
|
37
|
+
action: IAction;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=postSendOperations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postSendOperations.d.ts","sourceRoot":"","sources":["../../src/types/postSendOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,oBAAoB,EACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,WAAW,4BAA4B;IACzC;;;;;OAKG;IACH,cAAc,EAAE,CAAC,kBAAkB,SAAS,YAAY,EACpD,OAAO,EAAE,cAAc,EAAE,EACzB,OAAO,EAAE,CACL,YAAY,EAAE,YAAY,CAAC,kBAAkB,CAAC,KAC7C,OAAO,CAAC,IAAI,CAAC,EAClB,eAAe,CAAC,EAAE,eAAe,KAChC,IAAI,CAAC;IAEV;;OAEG;IACH,GAAG,EAAE,MAAM,IAAI,CAAC;IAEhB;;;OAGG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG,YAAY,GAAG,GAAG,CAAC;AAExE,MAAM,MAAM,GAAG,GAAG;IACd,IAAI,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,oBAAoB,CAAC;IAE3B,OAAO,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACvB,IAAI,EAAE,gBAAgB,CAAC;IAEvB,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,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/response.d.ts
CHANGED
|
@@ -6,11 +6,12 @@ import { Reaction } from '../dtos/responses/reaction';
|
|
|
6
6
|
import { TextMessage } from '../dtos/responses/textMessage';
|
|
7
7
|
import { UnpinResponse } from '../dtos/responses/unpin';
|
|
8
8
|
import { VideoMessage } from '../dtos/responses/videoMessage';
|
|
9
|
-
import { IReplyCapture } from './capture';
|
|
10
9
|
import { ReplyInfo } from '../dtos/replyInfo';
|
|
11
10
|
import { TraceId } from './trace';
|
|
12
11
|
import { IAction } from './action';
|
|
12
|
+
import { PostSendOperation } from './postSendOperations';
|
|
13
13
|
import { PinResponse } from '../dtos/responses/pin';
|
|
14
|
+
import { DeleteMessageResponse } from '../dtos/responses/deleteMessage';
|
|
14
15
|
export declare const BotResponseTypes: {
|
|
15
16
|
readonly pin: "pin";
|
|
16
17
|
readonly unpin: "unpin";
|
|
@@ -20,8 +21,9 @@ export declare const BotResponseTypes: {
|
|
|
20
21
|
readonly react: "react";
|
|
21
22
|
readonly delay: "delay";
|
|
22
23
|
readonly inlineQuery: "inlineQuery";
|
|
24
|
+
readonly deleteMessage: "deleteMessage";
|
|
23
25
|
};
|
|
24
|
-
export type BotResponse = UnpinResponse | Reaction | TextMessage | VideoMessage | DelayResponse | InlineQueryResponse | ImageMessage | PinResponse;
|
|
26
|
+
export type BotResponse = UnpinResponse | Reaction | TextMessage | VideoMessage | DelayResponse | InlineQueryResponse | ImageMessage | PinResponse | DeleteMessageResponse;
|
|
25
27
|
export interface IChatResponse {
|
|
26
28
|
readonly kind: keyof typeof BotResponseTypes;
|
|
27
29
|
readonly chatInfo: ChatInfo;
|
|
@@ -30,7 +32,7 @@ export interface IChatResponse {
|
|
|
30
32
|
readonly action: IAction;
|
|
31
33
|
}
|
|
32
34
|
export interface IReplyResponse extends IChatResponse {
|
|
33
|
-
readonly
|
|
35
|
+
readonly postSendOperations: PostSendOperation[];
|
|
34
36
|
readonly replyInfo: ReplyInfo | undefined;
|
|
35
37
|
readonly disableWebPreview: boolean;
|
|
36
38
|
get quotelessReply(): IReplyResponse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/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,
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/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,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,eAAO,MAAM,gBAAgB;;;;;;;;;;CAUnB,CAAC;AAEX,MAAM,MAAM,WAAW,GACjB,aAAa,GACb,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,aAAa,GACb,mBAAmB,GACnB,YAAY,GACZ,WAAW,GACX,qBAAqB,CAAC;AAE5B,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,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACjD,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAEpC,IAAI,cAAc,IAAI,cAAc,CAAC;CACxC;AAED,MAAM,WAAW,yBAAyB,CAAC,KAAK,CAAE,SAAQ,cAAc;IACpE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;CAC3B"}
|
package/dist/types/response.js
CHANGED