chz-telegram-bot 0.2.0 → 0.3.0
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/commandTriggerCheckResult.d.ts +1 -0
- package/dist/dtos/commandTriggerCheckResult.d.ts.map +1 -1
- package/dist/dtos/commandTriggerCheckResult.js +3 -0
- package/dist/dtos/incomingMessage.d.ts +2 -1
- package/dist/dtos/incomingMessage.d.ts.map +1 -1
- package/dist/dtos/incomingMessage.js +5 -1
- package/dist/dtos/incomingQuery.d.ts +1 -0
- package/dist/dtos/incomingQuery.d.ts.map +1 -1
- package/dist/dtos/incomingQuery.js +1 -0
- package/dist/dtos/replyInfo.d.ts.map +1 -0
- package/dist/dtos/responses/delay.d.ts +1 -1
- package/dist/dtos/responses/delay.d.ts.map +1 -1
- package/dist/dtos/responses/imageMessage.d.ts +8 -7
- package/dist/dtos/responses/imageMessage.d.ts.map +1 -1
- package/dist/dtos/responses/imageMessage.js +1 -0
- package/dist/dtos/responses/reaction.d.ts +3 -4
- package/dist/dtos/responses/reaction.d.ts.map +1 -1
- package/dist/dtos/responses/textMessage.d.ts +8 -7
- package/dist/dtos/responses/textMessage.d.ts.map +1 -1
- package/dist/dtos/responses/textMessage.js +1 -0
- package/dist/dtos/responses/unpin.d.ts +1 -1
- package/dist/dtos/responses/unpin.d.ts.map +1 -1
- package/dist/dtos/responses/videoMessage.d.ts +8 -7
- package/dist/dtos/responses/videoMessage.d.ts.map +1 -1
- package/dist/dtos/responses/videoMessage.js +1 -0
- package/dist/entities/actions/commandAction.d.ts +1 -1
- package/dist/entities/actions/commandAction.d.ts.map +1 -1
- package/dist/entities/actions/commandAction.js +6 -11
- package/dist/entities/actions/inlineQueryAction.d.ts +2 -3
- package/dist/entities/actions/inlineQueryAction.d.ts.map +1 -1
- package/dist/entities/actions/replyCaptureAction.d.ts +15 -0
- package/dist/entities/actions/replyCaptureAction.d.ts.map +1 -0
- package/dist/entities/actions/replyCaptureAction.js +56 -0
- package/dist/entities/actions/scheduledAction.d.ts +1 -1
- package/dist/entities/actions/scheduledAction.d.ts.map +1 -1
- package/dist/entities/botInstance.d.ts +7 -36
- package/dist/entities/botInstance.d.ts.map +1 -1
- package/dist/entities/botInstance.js +5 -162
- package/dist/entities/context/chatContext.d.ts +7 -5
- package/dist/entities/context/chatContext.d.ts.map +1 -1
- package/dist/entities/context/chatContext.js +21 -3
- package/dist/entities/context/inlineQueryContext.d.ts +7 -3
- package/dist/entities/context/inlineQueryContext.d.ts.map +1 -1
- package/dist/entities/context/inlineQueryContext.js +0 -11
- package/dist/entities/context/messageContext.d.ts +6 -6
- package/dist/entities/context/messageContext.d.ts.map +1 -1
- package/dist/entities/context/messageContext.js +10 -4
- package/dist/entities/context/replyContext.d.ts +113 -0
- package/dist/entities/context/replyContext.d.ts.map +1 -0
- package/dist/entities/context/replyContext.js +108 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +5 -9
- package/dist/services/actionProcessingService.d.ts +25 -0
- package/dist/services/actionProcessingService.d.ts.map +1 -0
- package/dist/services/actionProcessingService.js +40 -0
- package/dist/services/actionProcessors/commandActionProcessor.d.ts +28 -0
- package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/commandActionProcessor.js +116 -0
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts +20 -0
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/inlineQueryActionProcessor.js +74 -0
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts +21 -0
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/scheduledActionProcessor.js +69 -0
- package/dist/services/jsonFileStorage.d.ts +1 -1
- package/dist/services/jsonFileStorage.d.ts.map +1 -1
- package/dist/services/telegramApi.d.ts +5 -1
- package/dist/services/telegramApi.d.ts.map +1 -1
- package/dist/services/telegramApi.js +18 -8
- package/dist/types/{actionWithState.d.ts → action.d.ts} +5 -3
- package/dist/types/action.d.ts.map +1 -0
- package/dist/types/capture.d.ts +14 -0
- package/dist/types/capture.d.ts.map +1 -0
- package/dist/types/response.d.ts +9 -6
- package/dist/types/response.d.ts.map +1 -1
- package/dist/types/storage.d.ts +1 -1
- package/dist/types/storage.d.ts.map +1 -1
- package/dtos/commandTriggerCheckResult.ts +3 -0
- package/dtos/incomingMessage.ts +7 -2
- package/dtos/incomingQuery.ts +2 -0
- package/dtos/responses/delay.ts +1 -1
- package/dtos/responses/imageMessage.ts +11 -7
- package/dtos/responses/reaction.ts +3 -4
- package/dtos/responses/textMessage.ts +11 -7
- package/dtos/responses/unpin.ts +1 -1
- package/dtos/responses/videoMessage.ts +11 -7
- package/entities/actions/commandAction.ts +11 -18
- package/entities/actions/inlineQueryAction.ts +2 -3
- package/entities/actions/replyCaptureAction.ts +104 -0
- package/entities/actions/scheduledAction.ts +1 -1
- package/entities/botInstance.ts +19 -347
- package/entities/context/chatContext.ts +59 -29
- package/entities/context/inlineQueryContext.ts +7 -22
- package/entities/context/messageContext.ts +36 -29
- package/entities/context/replyContext.ts +225 -0
- package/main.ts +11 -10
- package/package.json +1 -1
- package/services/actionProcessingService.ts +123 -0
- package/services/actionProcessors/commandActionProcessor.ts +242 -0
- package/services/actionProcessors/inlineQueryActionProcessor.ts +176 -0
- package/services/actionProcessors/scheduledActionProcessor.ts +145 -0
- package/services/jsonFileStorage.ts +1 -1
- package/services/telegramApi.ts +45 -17
- package/types/{statefulAction.ts → action.ts} +6 -2
- package/types/capture.ts +21 -0
- package/types/response.ts +10 -6
- package/types/storage.ts +1 -1
- package/dist/types/actionWithState.d.ts.map +0 -1
- package/dist/types/replyInfo.d.ts.map +0 -1
- package/dist/types/statefulAction.d.ts +0 -9
- package/dist/types/statefulAction.d.ts.map +0 -1
- package/dist/types/statelessAction.d.ts +0 -5
- package/dist/types/statelessAction.d.ts.map +0 -1
- package/dist/types/statelessAction.js +0 -2
- package/types/statelessAction.ts +0 -5
- /package/dist/{types → dtos}/replyInfo.d.ts +0 -0
- /package/dist/{types → dtos}/replyInfo.js +0 -0
- /package/dist/types/{actionWithState.js → action.js} +0 -0
- /package/dist/types/{statefulAction.js → capture.js} +0 -0
- /package/{types → dtos}/replyInfo.ts +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare class CommandTriggerCheckResult {
|
|
2
2
|
static get DontTriggerAndSkipCooldown(): CommandTriggerCheckResult;
|
|
3
3
|
static get DoNotTrigger(): CommandTriggerCheckResult;
|
|
4
|
+
static get Trigger(): CommandTriggerCheckResult;
|
|
4
5
|
readonly shouldExecute: boolean;
|
|
5
6
|
readonly matchResults: RegExpExecArray[];
|
|
6
7
|
readonly skipCooldown: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandTriggerCheckResult.d.ts","sourceRoot":"","sources":["../../dtos/commandTriggerCheckResult.ts"],"names":[],"mappings":"AAAA,qBAAa,yBAAyB;IAClC,MAAM,KAAK,0BAA0B,8BAEpC;IACD,MAAM,KAAK,YAAY,8BAEtB;IAED,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,eAAe,EAAE,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;gBAG3B,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,eAAe,EAAE,EAC/B,YAAY,EAAE,OAAO;IAOzB,SAAS,CAAC,KAAK,EAAE,yBAAyB;CAO7C"}
|
|
1
|
+
{"version":3,"file":"commandTriggerCheckResult.d.ts","sourceRoot":"","sources":["../../dtos/commandTriggerCheckResult.ts"],"names":[],"mappings":"AAAA,qBAAa,yBAAyB;IAClC,MAAM,KAAK,0BAA0B,8BAEpC;IACD,MAAM,KAAK,YAAY,8BAEtB;IACD,MAAM,KAAK,OAAO,8BAEjB;IAED,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,eAAe,EAAE,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;gBAG3B,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,eAAe,EAAE,EAC/B,YAAY,EAAE,OAAO;IAOzB,SAAS,CAAC,KAAK,EAAE,yBAAyB;CAO7C"}
|
|
@@ -8,6 +8,9 @@ class CommandTriggerCheckResult {
|
|
|
8
8
|
static get DoNotTrigger() {
|
|
9
9
|
return new CommandTriggerCheckResult(false, [], false);
|
|
10
10
|
}
|
|
11
|
+
static get Trigger() {
|
|
12
|
+
return new CommandTriggerCheckResult(true, [], false);
|
|
13
|
+
}
|
|
11
14
|
constructor(shouldExecute, matchResults, skipCooldown) {
|
|
12
15
|
this.shouldExecute = shouldExecute;
|
|
13
16
|
this.matchResults = matchResults;
|
|
@@ -3,12 +3,13 @@ import { MessageTypeValue, TelegrafContextMessage } from '../types/messageTypes'
|
|
|
3
3
|
import { ChatInfo } from './chatInfo';
|
|
4
4
|
import { TraceId } from '../types/trace';
|
|
5
5
|
export declare class IncomingMessage {
|
|
6
|
-
readonly
|
|
6
|
+
readonly messageId: number;
|
|
7
7
|
readonly chatInfo: ChatInfo;
|
|
8
8
|
readonly from: User | undefined;
|
|
9
9
|
readonly text: string;
|
|
10
10
|
readonly type: MessageTypeValue;
|
|
11
11
|
readonly traceId: TraceId;
|
|
12
|
+
readonly replyToMessageId: number | undefined;
|
|
12
13
|
readonly updateObject: TelegrafContextMessage;
|
|
13
14
|
private detectMessageType;
|
|
14
15
|
constructor(ctxMessage: TelegrafContextMessage, botName: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incomingMessage.d.ts","sourceRoot":"","sources":["../../dtos/incomingMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAEH,gBAAgB,EAChB,sBAAsB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,eAAe;IACxB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"incomingMessage.d.ts","sourceRoot":"","sources":["../../dtos/incomingMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAEH,gBAAgB,EAChB,sBAAsB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,eAAe;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9C,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;IAE9C,OAAO,CAAC,iBAAiB;gBAmBb,UAAU,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM;CAsBlE"}
|
|
@@ -35,7 +35,11 @@ class IncomingMessage {
|
|
|
35
35
|
}
|
|
36
36
|
constructor(ctxMessage, botName) {
|
|
37
37
|
this.traceId = (0, traceFactory_1.createTrace)(this, botName, (0, crypto_1.randomInt)(10000, 99999).toString());
|
|
38
|
-
this.
|
|
38
|
+
this.messageId = ctxMessage.message_id;
|
|
39
|
+
this.replyToMessageId =
|
|
40
|
+
'reply_to_message' in ctxMessage
|
|
41
|
+
? ctxMessage.reply_to_message?.message_id
|
|
42
|
+
: undefined;
|
|
39
43
|
this.from = ctxMessage.from;
|
|
40
44
|
this.text = 'text' in ctxMessage ? ctxMessage.text : '';
|
|
41
45
|
this.chatInfo = new chatInfo_1.ChatInfo(ctxMessage.chat.id, 'title' in ctxMessage.chat
|
|
@@ -4,6 +4,7 @@ export declare class IncomingInlineQuery {
|
|
|
4
4
|
readonly query: string;
|
|
5
5
|
readonly userId: number;
|
|
6
6
|
readonly traceId: TraceId;
|
|
7
|
+
readonly abortController: AbortController;
|
|
7
8
|
constructor(queryId: string, query: string, userId: number, traceId: TraceId);
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=incomingQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incomingQuery.d.ts","sourceRoot":"","sources":["../../dtos/incomingQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,mBAAmB;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"incomingQuery.d.ts","sourceRoot":"","sources":["../../dtos/incomingQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,mBAAmB;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;gBAGtC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO;CAQvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replyInfo.d.ts","sourceRoot":"","sources":["../../dtos/replyInfo.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAS;IAClB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEvB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAIzC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IActionState } from '../../types/actionState';
|
|
2
|
-
import { IActionWithState } from '../../types/
|
|
2
|
+
import { IActionWithState } from '../../types/action';
|
|
3
3
|
import { IChatResponse } from '../../types/response';
|
|
4
4
|
import { Milliseconds } from '../../types/timeValues';
|
|
5
5
|
import { TraceId } from '../../types/trace';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../../dtos/responses/delay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../../dtos/responses/delay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBAAa,aAAc,YAAW,aAAa;IAC/C,QAAQ,CAAC,IAAI,UAA0B;IACvC,QAAQ,CAAC,SAAS,SAAc;IAEhC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;gBAG5C,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC;CAO7C"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { InputFile } from 'telegraf/types';
|
|
2
|
-
import {
|
|
2
|
+
import { IReplyResponseWithContent } from '../../types/response';
|
|
3
3
|
import { MessageSendingOptions } from '../../types/messageSendingOptions';
|
|
4
|
-
import {
|
|
5
|
-
import { IActionState } from '../../types/actionState';
|
|
4
|
+
import { IAction } from '../../types/action';
|
|
6
5
|
import { ChatInfo } from '../chatInfo';
|
|
7
6
|
import { TraceId } from '../../types/trace';
|
|
8
|
-
import { ReplyInfo } from '
|
|
9
|
-
|
|
7
|
+
import { ReplyInfo } from '../replyInfo';
|
|
8
|
+
import { IReplyCapture } from '../../types/capture';
|
|
9
|
+
export declare class ImageMessage implements IReplyResponseWithContent<InputFile> {
|
|
10
10
|
readonly kind: "image";
|
|
11
11
|
readonly createdAt: number;
|
|
12
|
+
readonly captures: IReplyCapture[];
|
|
12
13
|
readonly content: InputFile;
|
|
13
14
|
readonly chatInfo: ChatInfo;
|
|
14
15
|
readonly replyInfo: ReplyInfo | undefined;
|
|
15
16
|
readonly traceId: TraceId;
|
|
16
17
|
readonly disableWebPreview = false;
|
|
17
18
|
readonly shouldPin: boolean;
|
|
18
|
-
readonly action:
|
|
19
|
-
constructor(image: InputFile, chatInfo: ChatInfo, traceId: TraceId, action:
|
|
19
|
+
readonly action: IAction;
|
|
20
|
+
constructor(image: InputFile, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo: ReplyInfo | undefined, options?: MessageSendingOptions);
|
|
20
21
|
}
|
|
21
22
|
//# sourceMappingURL=imageMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageMessage.d.ts","sourceRoot":"","sources":["../../../dtos/responses/imageMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"imageMessage.d.ts","sourceRoot":"","sources":["../../../dtos/responses/imageMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,YAAa,YAAW,yBAAyB,CAAC,SAAS,CAAC;IACrE,QAAQ,CAAC,IAAI,UAA0B;IACvC,QAAQ,CAAC,SAAS,SAAc;IAChC,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAM;IAExC,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,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGrB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,OAAO,CAAC,EAAE,qBAAqB;CAStC"}
|
|
@@ -6,6 +6,7 @@ class ImageMessage {
|
|
|
6
6
|
constructor(image, chatInfo, traceId, action, replyInfo, options) {
|
|
7
7
|
this.kind = response_1.BotResponseTypes.image;
|
|
8
8
|
this.createdAt = Date.now();
|
|
9
|
+
this.captures = [];
|
|
9
10
|
this.disableWebPreview = false;
|
|
10
11
|
this.content = image;
|
|
11
12
|
this.chatInfo = chatInfo;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TelegramEmoji } from 'telegraf/types';
|
|
2
2
|
import { IChatResponse } from '../../types/response';
|
|
3
|
-
import {
|
|
4
|
-
import { IActionState } from '../../types/actionState';
|
|
3
|
+
import { IAction } from '../../types/action';
|
|
5
4
|
import { ChatInfo } from '../chatInfo';
|
|
6
5
|
import { TraceId } from '../../types/trace';
|
|
7
6
|
export declare class Reaction implements IChatResponse {
|
|
@@ -11,7 +10,7 @@ export declare class Reaction implements IChatResponse {
|
|
|
11
10
|
readonly messageId: number;
|
|
12
11
|
readonly traceId: TraceId;
|
|
13
12
|
readonly emoji: TelegramEmoji;
|
|
14
|
-
readonly action:
|
|
15
|
-
constructor(traceId: TraceId, chatInfo: ChatInfo, messageId: number, emoji: TelegramEmoji, action:
|
|
13
|
+
readonly action: IAction;
|
|
14
|
+
constructor(traceId: TraceId, chatInfo: ChatInfo, messageId: number, emoji: TelegramEmoji, action: IAction);
|
|
16
15
|
}
|
|
17
16
|
//# sourceMappingURL=reaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../dtos/responses/reaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../dtos/responses/reaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,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,QAAS,YAAW,aAAa;IAC1C,QAAQ,CAAC,IAAI,UAA0B;IACvC,QAAQ,CAAC,SAAS,SAAc;IAEhC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGrB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,OAAO;CAQtB"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { TextMessageSendingOptions } from '../../types/messageSendingOptions';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { IActionState } from '../../types/actionState';
|
|
2
|
+
import { IReplyResponseWithContent } from '../../types/response';
|
|
3
|
+
import { IAction } from '../../types/action';
|
|
5
4
|
import { ChatInfo } from '../chatInfo';
|
|
6
5
|
import { TraceId } from '../../types/trace';
|
|
7
|
-
import { ReplyInfo } from '
|
|
8
|
-
|
|
6
|
+
import { ReplyInfo } from '../replyInfo';
|
|
7
|
+
import { IReplyCapture } from '../../types/capture';
|
|
8
|
+
export declare class TextMessage implements IReplyResponseWithContent<string> {
|
|
9
9
|
readonly kind: "text";
|
|
10
10
|
readonly createdAt: number;
|
|
11
|
+
readonly captures: IReplyCapture[];
|
|
11
12
|
readonly content: string;
|
|
12
13
|
readonly chatInfo: ChatInfo;
|
|
13
14
|
readonly replyInfo: ReplyInfo | undefined;
|
|
14
15
|
readonly traceId: TraceId;
|
|
15
16
|
readonly disableWebPreview: boolean;
|
|
16
17
|
readonly shouldPin: boolean;
|
|
17
|
-
readonly action:
|
|
18
|
-
constructor(text: string, chatInfo: ChatInfo, traceId: TraceId, action:
|
|
18
|
+
readonly action: IAction;
|
|
19
|
+
constructor(text: string, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo?: ReplyInfo, options?: TextMessageSendingOptions);
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=textMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textMessage.d.ts","sourceRoot":"","sources":["../../../dtos/responses/textMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,
|
|
1
|
+
{"version":3,"file":"textMessage.d.ts","sourceRoot":"","sources":["../../../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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,WAAY,YAAW,yBAAyB,CAAC,MAAM,CAAC;IACjE,QAAQ,CAAC,IAAI,SAAyB;IACtC,QAAQ,CAAC,SAAS,SAAc;IAChC,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAM;IAExC,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;gBAGrB,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;CAU1C"}
|
|
@@ -6,6 +6,7 @@ class TextMessage {
|
|
|
6
6
|
constructor(text, chatInfo, traceId, action, replyInfo, options) {
|
|
7
7
|
this.kind = response_1.BotResponseTypes.text;
|
|
8
8
|
this.createdAt = Date.now();
|
|
9
|
+
this.captures = [];
|
|
9
10
|
this.content = text;
|
|
10
11
|
this.chatInfo = chatInfo;
|
|
11
12
|
this.replyInfo = replyInfo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IChatResponse } from '../../types/response';
|
|
2
|
-
import { IActionWithState } from '../../types/
|
|
2
|
+
import { IActionWithState } from '../../types/action';
|
|
3
3
|
import { IActionState } from '../../types/actionState';
|
|
4
4
|
import { ChatInfo } from '../chatInfo';
|
|
5
5
|
import { TraceId } from '../../types/trace';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpin.d.ts","sourceRoot":"","sources":["../../../dtos/responses/unpin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"unpin.d.ts","sourceRoot":"","sources":["../../../dtos/responses/unpin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,qBAAa,aAAc,YAAW,aAAa;IAC/C,QAAQ,CAAC,IAAI,UAA0B;IACvC,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,gBAAgB,CAAC,YAAY,CAAC,CAAC;gBAG5C,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC;CAO7C"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { InputFile } from 'telegraf/types';
|
|
2
|
-
import {
|
|
2
|
+
import { IReplyResponseWithContent } from '../../types/response';
|
|
3
3
|
import { MessageSendingOptions } from '../../types/messageSendingOptions';
|
|
4
|
-
import {
|
|
5
|
-
import { IActionState } from '../../types/actionState';
|
|
4
|
+
import { IAction } from '../../types/action';
|
|
6
5
|
import { ChatInfo } from '../chatInfo';
|
|
7
6
|
import { TraceId } from '../../types/trace';
|
|
8
|
-
import { ReplyInfo } from '
|
|
9
|
-
|
|
7
|
+
import { ReplyInfo } from '../replyInfo';
|
|
8
|
+
import { IReplyCapture } from '../../types/capture';
|
|
9
|
+
export declare class VideoMessage implements IReplyResponseWithContent<InputFile> {
|
|
10
10
|
readonly kind: "video";
|
|
11
11
|
readonly createdAt: number;
|
|
12
|
+
readonly captures: IReplyCapture[];
|
|
12
13
|
readonly content: InputFile;
|
|
13
14
|
readonly chatInfo: ChatInfo;
|
|
14
15
|
readonly replyInfo: ReplyInfo | undefined;
|
|
15
16
|
readonly traceId: TraceId;
|
|
16
17
|
readonly disableWebPreview = false;
|
|
17
18
|
readonly shouldPin: boolean;
|
|
18
|
-
readonly action:
|
|
19
|
-
constructor(video: InputFile, chatInfo: ChatInfo, traceId: TraceId, action:
|
|
19
|
+
readonly action: IAction;
|
|
20
|
+
constructor(video: InputFile, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo: ReplyInfo | undefined, options?: MessageSendingOptions);
|
|
20
21
|
}
|
|
21
22
|
//# sourceMappingURL=videoMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"videoMessage.d.ts","sourceRoot":"","sources":["../../../dtos/responses/videoMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"videoMessage.d.ts","sourceRoot":"","sources":["../../../dtos/responses/videoMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,YAAa,YAAW,yBAAyB,CAAC,SAAS,CAAC;IACrE,QAAQ,CAAC,IAAI,UAA0B;IACvC,QAAQ,CAAC,SAAS,SAAc;IAChC,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAM;IAExC,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,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGrB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,OAAO,CAAC,EAAE,qBAAqB;CAStC"}
|
|
@@ -6,6 +6,7 @@ class VideoMessage {
|
|
|
6
6
|
constructor(video, chatInfo, traceId, action, replyInfo, options) {
|
|
7
7
|
this.kind = response_1.BotResponseTypes.video;
|
|
8
8
|
this.createdAt = Date.now();
|
|
9
|
+
this.captures = [];
|
|
9
10
|
this.disableWebPreview = false;
|
|
10
11
|
this.content = video;
|
|
11
12
|
this.chatInfo = chatInfo;
|
|
@@ -2,7 +2,7 @@ import { CommandHandler } from '../../types/handlers';
|
|
|
2
2
|
import { CommandCondition } from '../../types/commandCondition';
|
|
3
3
|
import { Seconds } from '../../types/timeValues';
|
|
4
4
|
import { IActionState } from '../../types/actionState';
|
|
5
|
-
import { IActionWithState, ActionKey } from '../../types/
|
|
5
|
+
import { IActionWithState, ActionKey } from '../../types/action';
|
|
6
6
|
import { MessageContext } from '../context/messageContext';
|
|
7
7
|
import { CommandTrigger } from '../../types/commandTrigger';
|
|
8
8
|
export declare class CommandAction<TActionState extends IActionState> implements IActionWithState<TActionState> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandAction.d.ts","sourceRoot":"","sources":["../../../entities/actions/commandAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"commandAction.d.ts","sourceRoot":"","sources":["../../../entities/actions/commandAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,qBAAa,aAAa,CAAC,YAAY,SAAS,YAAY,CACxD,YAAW,gBAAgB,CAAC,YAAY,CAAC;IAEzC,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACnD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,YAAY,CAAC;IAC9C,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;gBAGhD,OAAO,EAAE,cAAc,GAAG,cAAc,EAAE,EAC1C,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC,EACrC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,OAAO,EACjB,cAAc,EAAE,MAAM,EAAE,EACxB,YAAY,EAAE,MAAM,EAAE,EACtB,SAAS,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACzC,gBAAgB,EAAE,MAAM,YAAY,EACpC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM;IAgBxC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,YAAY,CAAC;IAkD5C,OAAO,CAAC,uBAAuB;IA+B/B,OAAO,CAAC,YAAY;CAmCvB"}
|
|
@@ -61,17 +61,15 @@ class CommandAction {
|
|
|
61
61
|
const isCustomConditionMet = this.condition(ctx);
|
|
62
62
|
if (!isCustomConditionMet)
|
|
63
63
|
return commandTriggerCheckResult_1.CommandTriggerCheckResult.DontTriggerAndSkipCooldown;
|
|
64
|
-
|
|
65
|
-
return new commandTriggerCheckResult_1.CommandTriggerCheckResult(shouldTrigger, matchResults, false);
|
|
64
|
+
return this.checkTrigger(ctx, trigger);
|
|
66
65
|
}
|
|
67
66
|
checkTrigger(ctx, trigger) {
|
|
68
67
|
if (trigger == ctx.messageType)
|
|
69
|
-
return
|
|
68
|
+
return commandTriggerCheckResult_1.CommandTriggerCheckResult.Trigger;
|
|
70
69
|
if (typeof trigger == 'string')
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
};
|
|
70
|
+
return ctx.messageText.toLowerCase() == trigger.toLowerCase()
|
|
71
|
+
? commandTriggerCheckResult_1.CommandTriggerCheckResult.Trigger
|
|
72
|
+
: commandTriggerCheckResult_1.CommandTriggerCheckResult.DoNotTrigger;
|
|
75
73
|
const matchResults = [];
|
|
76
74
|
trigger.lastIndex = 0;
|
|
77
75
|
const execResult = trigger.exec(ctx.messageText);
|
|
@@ -86,10 +84,7 @@ class CommandAction {
|
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
|
-
return
|
|
90
|
-
shouldTrigger: matchResults.length > 0,
|
|
91
|
-
matchResults
|
|
92
|
-
};
|
|
87
|
+
return new commandTriggerCheckResult_1.CommandTriggerCheckResult(matchResults.length > 0, matchResults, false);
|
|
93
88
|
}
|
|
94
89
|
}
|
|
95
90
|
exports.CommandAction = CommandAction;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ActionKey } from '../../types/
|
|
1
|
+
import { ActionKey, IAction } from '../../types/action';
|
|
2
2
|
import { InlineQueryContext } from '../context/inlineQueryContext';
|
|
3
3
|
import { InlineQueryHandler } from '../../types/handlers';
|
|
4
|
-
|
|
5
|
-
export declare class InlineQueryAction implements IActionWithoutState {
|
|
4
|
+
export declare class InlineQueryAction implements IAction {
|
|
6
5
|
readonly key: ActionKey;
|
|
7
6
|
readonly active: boolean;
|
|
8
7
|
readonly handler: InlineQueryHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineQueryAction.d.ts","sourceRoot":"","sources":["../../../entities/actions/inlineQueryAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"inlineQueryAction.d.ts","sourceRoot":"","sources":["../../../entities/actions/inlineQueryAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,qBAAa,iBAAkB,YAAW,OAAO;IAC7C,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,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,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM;IAUb,IAAI,CAAC,GAAG,EAAE,kBAAkB;CAwCrC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IActionState } from '../../types/actionState';
|
|
2
|
+
import { CommandTrigger } from '../../types/commandTrigger';
|
|
3
|
+
import { ActionKey, IAction, IActionWithState } from '../../types/action';
|
|
4
|
+
import { ReplyContext } from '../context/replyContext';
|
|
5
|
+
export declare class ReplyCaptureAction<TParentActionState extends IActionState> implements IAction {
|
|
6
|
+
readonly parentMessageId: number;
|
|
7
|
+
readonly key: ActionKey;
|
|
8
|
+
readonly handler: (replyContext: ReplyContext<TParentActionState>) => Promise<void>;
|
|
9
|
+
readonly triggers: CommandTrigger[];
|
|
10
|
+
readonly abortController: AbortController;
|
|
11
|
+
constructor(parentMessageId: number, parentAction: IActionWithState<TParentActionState>, handler: (replyContext: ReplyContext<TParentActionState>) => Promise<void>, triggers: CommandTrigger[], abortController: AbortController);
|
|
12
|
+
exec(ctx: ReplyContext<TParentActionState>): Promise<import("../../types/response").BotResponse[]>;
|
|
13
|
+
private checkIfShouldBeExecuted;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=replyCaptureAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replyCaptureAction.d.ts","sourceRoot":"","sources":["../../../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,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qBAAa,kBAAkB,CAAC,kBAAkB,SAAS,YAAY,CACnE,YAAW,OAAO;IAElB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,CACd,YAAY,EAAE,YAAY,CAAC,kBAAkB,CAAC,KAC7C,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,gBAAgB,CAAC,kBAAkB,CAAC,EAClD,OAAO,EAAE,CACL,YAAY,EAAE,YAAY,CAAC,kBAAkB,CAAC,KAC7C,OAAO,CAAC,IAAI,CAAC,EAClB,QAAQ,EAAE,cAAc,EAAE,EAC1B,eAAe,EAAE,eAAe;IAY9B,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,kBAAkB,CAAC;IA4BhD,OAAO,CAAC,uBAAuB;CAsClC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReplyCaptureAction = void 0;
|
|
4
|
+
const commandTriggerCheckResult_1 = require("../../dtos/commandTriggerCheckResult");
|
|
5
|
+
const noop_1 = require("../../helpers/noop");
|
|
6
|
+
class ReplyCaptureAction {
|
|
7
|
+
constructor(parentMessageId, parentAction, handler, triggers, abortController) {
|
|
8
|
+
this.parentMessageId = parentMessageId;
|
|
9
|
+
this.handler = handler;
|
|
10
|
+
this.triggers = triggers;
|
|
11
|
+
this.abortController = abortController;
|
|
12
|
+
this.key = `capture:${parentAction.key}:${Math.random()
|
|
13
|
+
.toString()
|
|
14
|
+
.replace('.', '')}`;
|
|
15
|
+
}
|
|
16
|
+
async exec(ctx) {
|
|
17
|
+
if (!ctx.isInitialized)
|
|
18
|
+
throw new Error(`Context for ${this.key} is not initialized or already consumed`);
|
|
19
|
+
const { shouldExecute, matchResults } = this.triggers
|
|
20
|
+
.map((x) => this.checkIfShouldBeExecuted(ctx, x))
|
|
21
|
+
.reduce((acc, curr) => acc.mergeWith(curr), commandTriggerCheckResult_1.CommandTriggerCheckResult.DoNotTrigger);
|
|
22
|
+
if (!shouldExecute)
|
|
23
|
+
return noop_1.Noop.NoResponse;
|
|
24
|
+
ctx.logger.logWithTraceId(ctx.botName, ctx.traceId, ctx.chatInfo.name, ` - Executing [${this.key}] in ${ctx.chatInfo.id}`);
|
|
25
|
+
ctx.matchResults = matchResults;
|
|
26
|
+
await this.handler(ctx);
|
|
27
|
+
return ctx.responses;
|
|
28
|
+
}
|
|
29
|
+
checkIfShouldBeExecuted(ctx, trigger) {
|
|
30
|
+
if (ctx.replyMessageId != this.parentMessageId)
|
|
31
|
+
return commandTriggerCheckResult_1.CommandTriggerCheckResult.DoNotTrigger;
|
|
32
|
+
if (trigger == ctx.messageType)
|
|
33
|
+
return commandTriggerCheckResult_1.CommandTriggerCheckResult.Trigger;
|
|
34
|
+
if (typeof trigger == 'string')
|
|
35
|
+
if (ctx.messageText.toLowerCase() == trigger.toLowerCase())
|
|
36
|
+
return commandTriggerCheckResult_1.CommandTriggerCheckResult.Trigger;
|
|
37
|
+
else
|
|
38
|
+
return commandTriggerCheckResult_1.CommandTriggerCheckResult.DoNotTrigger;
|
|
39
|
+
const matchResults = [];
|
|
40
|
+
trigger.lastIndex = 0;
|
|
41
|
+
const execResult = trigger.exec(ctx.messageText);
|
|
42
|
+
if (execResult != null) {
|
|
43
|
+
matchResults.push(execResult);
|
|
44
|
+
if (trigger.global) {
|
|
45
|
+
while (true) {
|
|
46
|
+
const nextResult = trigger.exec(ctx.messageText);
|
|
47
|
+
if (nextResult == null)
|
|
48
|
+
break;
|
|
49
|
+
matchResults.push(nextResult);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return new commandTriggerCheckResult_1.CommandTriggerCheckResult(matchResults.length > 0, matchResults, false);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.ReplyCaptureAction = ReplyCaptureAction;
|
|
@@ -2,7 +2,7 @@ import { Sema as Semaphore } from 'async-sema';
|
|
|
2
2
|
import { ScheduledHandler } from '../../types/handlers';
|
|
3
3
|
import { HoursOfDay } from '../../types/timeValues';
|
|
4
4
|
import { IActionState } from '../../types/actionState';
|
|
5
|
-
import { IActionWithState, ActionKey } from '../../types/
|
|
5
|
+
import { IActionWithState, ActionKey } from '../../types/action';
|
|
6
6
|
import { CachedStateFactory } from '../cachedStateFactory';
|
|
7
7
|
import { ChatContext } from '../context/chatContext';
|
|
8
8
|
export declare class ScheduledAction<TActionState extends IActionState> implements IActionWithState<TActionState> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduledAction.d.ts","sourceRoot":"","sources":["../../../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;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"scheduledAction.d.ts","sourceRoot":"","sources":["../../../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;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,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,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,qBAAa,eAAe,CAAC,YAAY,SAAS,YAAY,CAC1D,YAAW,gBAAgB,CAAC,YAAY,CAAC;IAEzC,MAAM,CAAC,QAAQ,CAAC,KAAK,yBAAgC;IAErD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IAExB,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,WAAW,EAAE,UAAU,EACvB,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EAAE,EACnB,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACrD,gBAAgB,EAAE,MAAM,YAAY;IAYlC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,YAAY,CAAC;YA0C3B,cAAc;IA+C5B,OAAO,CAAC,uBAAuB;CAalC"}
|
|
@@ -7,20 +7,13 @@ import { ILogger } from '../types/logger';
|
|
|
7
7
|
import { IScheduler } from '../types/scheduler';
|
|
8
8
|
import { InlineQueryAction } from './actions/inlineQueryAction';
|
|
9
9
|
export declare class BotInstance {
|
|
10
|
-
private readonly api;
|
|
11
10
|
private readonly storage;
|
|
12
11
|
private readonly scheduler;
|
|
13
12
|
private readonly logger;
|
|
14
|
-
private readonly
|
|
15
|
-
name: string;
|
|
16
|
-
private botInfo;
|
|
17
|
-
private commands;
|
|
18
|
-
private scheduled;
|
|
19
|
-
private inlineQueries;
|
|
20
|
-
private chats;
|
|
13
|
+
private readonly actionProcessingService;
|
|
14
|
+
readonly name: string;
|
|
21
15
|
constructor(options: {
|
|
22
16
|
name: string;
|
|
23
|
-
token: string;
|
|
24
17
|
actions: {
|
|
25
18
|
commands: CommandAction<IActionState>[];
|
|
26
19
|
scheduled: ScheduledAction<IActionState>[];
|
|
@@ -28,39 +21,17 @@ export declare class BotInstance {
|
|
|
28
21
|
};
|
|
29
22
|
chats: Record<string, number>;
|
|
30
23
|
storagePath?: string;
|
|
31
|
-
scheduledPeriod?: Seconds;
|
|
32
|
-
verboseLoggingForIncomingMessage?: boolean;
|
|
33
24
|
services?: {
|
|
34
25
|
storageClient?: IStorageClient;
|
|
35
26
|
logger?: ILogger;
|
|
36
27
|
scheduler?: IScheduler;
|
|
37
28
|
};
|
|
38
29
|
});
|
|
39
|
-
start(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
scheduled: ScheduledAction<IActionState>[];
|
|
45
|
-
inlineQueries: InlineQueryAction[];
|
|
46
|
-
};
|
|
47
|
-
chats: Record<string, number>;
|
|
48
|
-
storagePath?: string;
|
|
49
|
-
scheduledPeriod?: Seconds;
|
|
50
|
-
verboseLoggingForIncomingMessage?: boolean;
|
|
51
|
-
services?: {
|
|
52
|
-
storageClient?: IStorageClient;
|
|
53
|
-
logger?: ILogger;
|
|
54
|
-
scheduler?: IScheduler;
|
|
55
|
-
};
|
|
56
|
-
}): Promise<void>;
|
|
57
|
-
private initializeScheduledProcessing;
|
|
58
|
-
private initializeInlineQueryProcessing;
|
|
59
|
-
private initializeMessageProcessing;
|
|
30
|
+
start(token: string, actions: {
|
|
31
|
+
commands: CommandAction<IActionState>[];
|
|
32
|
+
scheduled: ScheduledAction<IActionState>[];
|
|
33
|
+
inlineQueries: InlineQueryAction[];
|
|
34
|
+
}, scheduledPeriod?: Seconds, verboseLoggingForIncomingMessage?: boolean): Promise<void>;
|
|
60
35
|
stop(code: string): Promise<void>;
|
|
61
|
-
private initializeMessageContext;
|
|
62
|
-
private initializeChatContext;
|
|
63
|
-
private runScheduled;
|
|
64
|
-
private processMessage;
|
|
65
36
|
}
|
|
66
37
|
//# sourceMappingURL=botInstance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"botInstance.d.ts","sourceRoot":"","sources":["../../entities/botInstance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"botInstance.d.ts","sourceRoot":"","sources":["../../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;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGhE,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA0B;IAElE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE;YACL,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;YACxC,SAAS,EAAE,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;YAC3C,aAAa,EAAE,iBAAiB,EAAE,CAAC;SACtC,CAAC;QACF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE;YACP,aAAa,CAAC,EAAE,cAAc,CAAC;YAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;YACjB,SAAS,CAAC,EAAE,UAAU,CAAC;SAC1B,CAAC;KACL;IA0BK,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,EACzB,gCAAgC,CAAC,EAAE,OAAO;IAiBxC,IAAI,CAAC,IAAI,EAAE,MAAM;CAY1B"}
|