chz-telegram-bot 0.7.21 → 0.7.23
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/imageMessage.d.ts +2 -3
- package/dist/dtos/responses/imageMessage.d.ts.map +1 -1
- package/dist/dtos/responses/imageMessage.js +4 -3
- package/dist/dtos/responses/pin.d.ts +15 -0
- package/dist/dtos/responses/pin.d.ts.map +1 -0
- package/dist/dtos/responses/pin.js +15 -0
- package/dist/dtos/responses/textMessage.d.ts +1 -0
- package/dist/dtos/responses/textMessage.d.ts.map +1 -1
- package/dist/dtos/responses/textMessage.js +3 -0
- package/dist/dtos/responses/videoMessage.d.ts +2 -3
- package/dist/dtos/responses/videoMessage.d.ts.map +1 -1
- package/dist/dtos/responses/videoMessage.js +4 -3
- package/dist/entities/actions/commandAction.js +5 -5
- package/dist/entities/actions/inlineQueryAction.d.ts.map +1 -1
- package/dist/entities/actions/replyCaptureAction.d.ts.map +1 -1
- package/dist/entities/actions/scheduledAction.d.ts.map +1 -1
- package/dist/entities/context/chatContext.d.ts +9 -3
- package/dist/entities/context/chatContext.d.ts.map +1 -1
- package/dist/entities/context/chatContext.js +13 -4
- package/dist/entities/context/messageContext.d.ts +5 -5
- package/dist/entities/context/messageContext.d.ts.map +1 -1
- package/dist/entities/context/messageContext.js +8 -8
- package/dist/entities/context/replyContext.d.ts +5 -5
- package/dist/entities/context/replyContext.d.ts.map +1 -1
- package/dist/entities/context/replyContext.js +12 -12
- package/dist/services/responseProcessingQueue.js +1 -1
- package/dist/services/telegramApi.d.ts +0 -1
- package/dist/services/telegramApi.d.ts.map +1 -1
- package/dist/services/telegramApi.js +43 -61
- package/dist/types/response.d.ts +4 -2
- package/dist/types/response.d.ts.map +1 -1
- package/dist/types/response.js +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IReplyResponseWithContent } from '../../types/response';
|
|
2
|
-
import { MessageSendingOptions } from '../../types/messageSendingOptions';
|
|
3
2
|
import { IAction } from '../../types/action';
|
|
4
3
|
import { ChatInfo } from '../chatInfo';
|
|
5
4
|
import { TraceId } from '../../types/trace';
|
|
@@ -15,8 +14,8 @@ export declare class ImageMessage implements IReplyResponseWithContent<InputFile
|
|
|
15
14
|
readonly replyInfo: ReplyInfo | undefined;
|
|
16
15
|
readonly traceId: TraceId;
|
|
17
16
|
readonly disableWebPreview = false;
|
|
18
|
-
readonly shouldPin: boolean;
|
|
19
17
|
readonly action: IAction;
|
|
20
|
-
constructor(image: InputFile, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo
|
|
18
|
+
constructor(image: InputFile, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo?: ReplyInfo);
|
|
19
|
+
get quotelessReply(): ImageMessage;
|
|
21
20
|
}
|
|
22
21
|
//# sourceMappingURL=imageMessage.d.ts.map
|
|
@@ -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,
|
|
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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,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,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,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"}
|
|
@@ -8,14 +8,15 @@ export class ImageMessage {
|
|
|
8
8
|
replyInfo;
|
|
9
9
|
traceId;
|
|
10
10
|
disableWebPreview = false;
|
|
11
|
-
shouldPin;
|
|
12
11
|
action;
|
|
13
|
-
constructor(image, chatInfo, traceId, action, replyInfo
|
|
12
|
+
constructor(image, chatInfo, traceId, action, replyInfo) {
|
|
14
13
|
this.content = image;
|
|
15
14
|
this.chatInfo = chatInfo;
|
|
16
15
|
this.replyInfo = replyInfo;
|
|
17
16
|
this.traceId = traceId;
|
|
18
|
-
this.shouldPin = options?.pin ?? false;
|
|
19
17
|
this.action = action;
|
|
20
18
|
}
|
|
19
|
+
get quotelessReply() {
|
|
20
|
+
return new ImageMessage(this.content, this.chatInfo, this.traceId, this.action, undefined);
|
|
21
|
+
}
|
|
21
22
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IChatResponse } from '../../types/response';
|
|
2
|
+
import { IActionWithState } from '../../types/action';
|
|
3
|
+
import { IActionState } from '../../types/actionState';
|
|
4
|
+
import { ChatInfo } from '../chatInfo';
|
|
5
|
+
import { TraceId } from '../../types/trace';
|
|
6
|
+
export declare class PinResponse implements IChatResponse {
|
|
7
|
+
readonly kind: "pin";
|
|
8
|
+
readonly createdAt: number;
|
|
9
|
+
readonly messageId: number;
|
|
10
|
+
readonly chatInfo: ChatInfo;
|
|
11
|
+
readonly traceId: TraceId;
|
|
12
|
+
readonly action: IActionWithState<IActionState>;
|
|
13
|
+
constructor(messageId: number, chatInfo: ChatInfo, traceId: TraceId, action: IActionWithState<IActionState>);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=pin.d.ts.map
|
|
@@ -0,0 +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,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,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,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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BotResponseTypes } from '../../types/response';
|
|
2
|
+
export class PinResponse {
|
|
3
|
+
kind = BotResponseTypes.pin;
|
|
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
|
+
}
|
|
@@ -19,5 +19,6 @@ export declare class TextMessage implements IReplyResponseWithContent<string> {
|
|
|
19
19
|
readonly action: IAction;
|
|
20
20
|
readonly keyboard?: TelegramInlineKeyboardButton[][];
|
|
21
21
|
constructor(text: string, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo?: ReplyInfo, options?: TextMessageSendingOptions);
|
|
22
|
+
get quotelessReply(): TextMessage;
|
|
22
23
|
}
|
|
23
24
|
//# sourceMappingURL=textMessage.d.ts.map
|
|
@@ -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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAE3E,qBAAa,WAAY,YAAW,yBAAyB,CAAC,MAAM,CAAC;IACjE,QAAQ,CAAC,IAAI,SAAyB;IACtC,QAAQ,CA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S,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;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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IReplyResponseWithContent } from '../../types/response';
|
|
2
|
-
import { MessageSendingOptions } from '../../types/messageSendingOptions';
|
|
3
2
|
import { IAction } from '../../types/action';
|
|
4
3
|
import { ChatInfo } from '../chatInfo';
|
|
5
4
|
import { TraceId } from '../../types/trace';
|
|
@@ -15,8 +14,8 @@ export declare class VideoMessage implements IReplyResponseWithContent<InputFile
|
|
|
15
14
|
readonly replyInfo: ReplyInfo | undefined;
|
|
16
15
|
readonly traceId: TraceId;
|
|
17
16
|
readonly disableWebPreview = false;
|
|
18
|
-
readonly shouldPin: boolean;
|
|
19
17
|
readonly action: IAction;
|
|
20
|
-
constructor(video: InputFile, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo
|
|
18
|
+
constructor(video: InputFile, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo?: ReplyInfo);
|
|
19
|
+
get quotelessReply(): VideoMessage;
|
|
21
20
|
}
|
|
22
21
|
//# sourceMappingURL=videoMessage.d.ts.map
|
|
@@ -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,
|
|
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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,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,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,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"}
|
|
@@ -8,14 +8,15 @@ export class VideoMessage {
|
|
|
8
8
|
replyInfo;
|
|
9
9
|
traceId;
|
|
10
10
|
disableWebPreview = false;
|
|
11
|
-
shouldPin;
|
|
12
11
|
action;
|
|
13
|
-
constructor(video, chatInfo, traceId, action, replyInfo
|
|
12
|
+
constructor(video, chatInfo, traceId, action, replyInfo) {
|
|
14
13
|
this.content = video;
|
|
15
14
|
this.chatInfo = chatInfo;
|
|
16
15
|
this.replyInfo = replyInfo;
|
|
17
16
|
this.traceId = traceId;
|
|
18
|
-
this.shouldPin = options?.pin ?? false;
|
|
19
17
|
this.action = action;
|
|
20
18
|
}
|
|
19
|
+
get quotelessReply() {
|
|
20
|
+
return new VideoMessage(this.content, this.chatInfo, this.traceId, this.action, undefined);
|
|
21
|
+
}
|
|
21
22
|
}
|
|
@@ -95,8 +95,13 @@ export class CommandAction {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
checkIfShouldBeExecuted(ctx, trigger, state) {
|
|
98
|
+
if (!ctx.userInfo.id)
|
|
99
|
+
return CommandTriggerCheckResult.DontTriggerAndSkipCooldown('UserIdMissing');
|
|
98
100
|
if (!this.isActiveProvider(ctx))
|
|
99
101
|
return CommandTriggerCheckResult.DontTriggerAndSkipCooldown('ActionDisabled');
|
|
102
|
+
const triggerCheckResult = this.checkTrigger(ctx, trigger);
|
|
103
|
+
if (!triggerCheckResult.shouldExecute)
|
|
104
|
+
return triggerCheckResult;
|
|
100
105
|
const chatsBlacklist = this.chatsBlacklistProvider(ctx);
|
|
101
106
|
const chatsWhitelist = this.chatsWhitelistProvider(ctx);
|
|
102
107
|
const isChatInBlacklist = chatsBlacklist.includes(ctx.chatInfo.id);
|
|
@@ -104,11 +109,6 @@ export class CommandAction {
|
|
|
104
109
|
chatsWhitelist.includes(ctx.chatInfo.id);
|
|
105
110
|
if (isChatInBlacklist || !isChatInWhitelist)
|
|
106
111
|
return CommandTriggerCheckResult.DontTriggerAndSkipCooldown('ChatForbidden');
|
|
107
|
-
const triggerCheckResult = this.checkTrigger(ctx, trigger);
|
|
108
|
-
if (!triggerCheckResult.shouldExecute)
|
|
109
|
-
return triggerCheckResult;
|
|
110
|
-
if (!ctx.userInfo.id)
|
|
111
|
-
return CommandTriggerCheckResult.DontTriggerAndSkipCooldown('UserIdMissing');
|
|
112
112
|
const usersWhitelist = this.usersWhitelistProvider(ctx);
|
|
113
113
|
const isUserAllowed = usersWhitelist.length == 0 ||
|
|
114
114
|
usersWhitelist.includes(ctx.userInfo.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineQueryAction.d.ts","sourceRoot":"","sources":["../../../src/entities/actions/inlineQueryAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAK5E,qBAAa,iBAAkB,YAAW,OAAO;IAC7C,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,gBAAgB,EAAE,4BAA4B,CAAC,OAAO,CAAC,CAAC;IACjE,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAGrB,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,4BAA4B,CAAC,OAAO,CAAC,EACrD,OAAO,EAAE,MAAM;IAUb,IAAI,CAAC,GAAG,EAAE,0BAA0B;
|
|
1
|
+
{"version":3,"file":"inlineQueryAction.d.ts","sourceRoot":"","sources":["../../../src/entities/actions/inlineQueryAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAK5E,qBAAa,iBAAkB,YAAW,OAAO;IAC7C,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,gBAAgB,EAAE,4BAA4B,CAAC,OAAO,CAAC,CAAC;IACjE,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAGrB,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,4BAA4B,CAAC,OAAO,CAAC,EACrD,OAAO,EAAE,MAAM;IAUb,IAAI,CAAC,GAAG,EAAE,0BAA0B;CAsD7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replyCaptureAction.d.ts","sourceRoot":"","sources":["../../../src/entities/actions/replyCaptureAction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAI/D,qBAAa,kBAAkB,CAC3B,kBAAkB,SAAS,YAAY,CACzC,YAAW,OAAO;IAChB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,O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OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAErC;IAEF,QAAQ,CAAC,WAAW,uBAA8B;IAClD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,YAAY,CAAC;IAC9C,QAAQ,CAAC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;gBAG7C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,EACvC,SAAS,EAAE,wBAAwB,EACnC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACrD,gBAAgB,EAAE,MAAM,YAAY;IAclC,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC,YAAY,CAAC;YAoDnC,cAAc;IA6D5B,OAAO,CAAC,uBAAuB;CAgBlC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TextMessageSendingOptions } from '../../types/messageSendingOptions';
|
|
2
2
|
import { IActionWithState } from '../../types/action';
|
|
3
3
|
import { IActionState } from '../../types/actionState';
|
|
4
4
|
import { Milliseconds } from '../../types/timeValues';
|
|
@@ -26,14 +26,14 @@ export declare class ChatContextInternal<TActionState extends IActionState, TAct
|
|
|
26
26
|
* @param name Message contents.
|
|
27
27
|
* @param options Message sending option.
|
|
28
28
|
*/
|
|
29
|
-
image: (name: string
|
|
29
|
+
image: (name: string) => import("../..").ICaptureController;
|
|
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
|
|
36
|
+
video: (name: string) => import("../..").ICaptureController;
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
39
39
|
* Unpins message after action execution is finished.
|
|
@@ -41,6 +41,12 @@ export declare class ChatContextInternal<TActionState extends IActionState, TAct
|
|
|
41
41
|
* @param messageId Message id.
|
|
42
42
|
*/
|
|
43
43
|
unpinMessage(messageId: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* Pins message after action execution is finished.
|
|
46
|
+
* 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.
|
|
47
|
+
* @param messageId Message id.
|
|
48
|
+
*/
|
|
49
|
+
pinMessage(messageId: number): void;
|
|
44
50
|
/**
|
|
45
51
|
* Delays next responses by specified amount of time.
|
|
46
52
|
* @param delay Delay in milliseconds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/chatContext.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"chatContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/chatContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EACH,mBAAmB,EACnB,2BAA2B,EAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,MAAM,MAAM,WAAW,CACnB,YAAY,SAAS,YAAY,EACjC,OAAO,SAAS,gBAAgB,CAAC,YAAY,CAAC,GAC1C,eAAe,CAAC,YAAY,CAAC,IACjC,IAAI,CACJ,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,EAC1C,2BAA2B,CAC9B,CAAC;AAEF;;GAEG;AACH,qBAAa,mBAAmB,CAC5B,YAAY,SAAS,YAAY,EACjC,OAAO,SAAS,gBAAgB,CAAC,YAAY,CAAC,GAC1C,eAAe,CAAC,YAAY,CAAC,CACnC,SAAQ,mBAAmB,CAAC,OAAO,CAAC;IAClC;;OAEG;IACH,IAAI;QACA;;;;;WAKG;qBACU,MAAM,YAAY,yBAAyB;QAexD;;;;;WAKG;sBACW,MAAM;QAapB;;;;;WAKG;sBACW,MAAM;MAYtB;IAEF;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM;IAW9B;;;;OAIG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM;IAW5B;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,YAAY;CAU3B"}
|
|
@@ -5,6 +5,7 @@ import { VideoMessage } from '../../dtos/responses/videoMessage';
|
|
|
5
5
|
import { UnpinResponse } from '../../dtos/responses/unpin';
|
|
6
6
|
import { DelayResponse } from '../../dtos/responses/delay';
|
|
7
7
|
import { BaseContextInternal } from './baseContext';
|
|
8
|
+
import { PinResponse } from '../../dtos/responses/pin';
|
|
8
9
|
/**
|
|
9
10
|
* Context of action executed in chat.
|
|
10
11
|
*/
|
|
@@ -30,8 +31,8 @@ export class ChatContextInternal extends BaseContextInternal {
|
|
|
30
31
|
* @param name Message contents.
|
|
31
32
|
* @param options Message sending option.
|
|
32
33
|
*/
|
|
33
|
-
image: (name
|
|
34
|
-
const response = new ImageMessage({ source: resolve(`./content/${name}.png`) }, this.chatInfo, this.observability.traceId, this.action
|
|
34
|
+
image: (name) => {
|
|
35
|
+
const response = new ImageMessage({ source: resolve(`./content/${name}.png`) }, this.chatInfo, this.observability.traceId, this.action);
|
|
35
36
|
this.responses.push(response);
|
|
36
37
|
return this.createCaptureController(response);
|
|
37
38
|
},
|
|
@@ -41,8 +42,8 @@ export class ChatContextInternal extends BaseContextInternal {
|
|
|
41
42
|
* @param name Message contents.
|
|
42
43
|
* @param options Message sending option.
|
|
43
44
|
*/
|
|
44
|
-
video: (name
|
|
45
|
-
const response = new VideoMessage({ source: resolve(`./content/${name}.mp4`) }, this.chatInfo, this.observability.traceId, this.action
|
|
45
|
+
video: (name) => {
|
|
46
|
+
const response = new VideoMessage({ source: resolve(`./content/${name}.mp4`) }, this.chatInfo, this.observability.traceId, this.action);
|
|
46
47
|
this.responses.push(response);
|
|
47
48
|
return this.createCaptureController(response);
|
|
48
49
|
}
|
|
@@ -55,6 +56,14 @@ export class ChatContextInternal extends BaseContextInternal {
|
|
|
55
56
|
unpinMessage(messageId) {
|
|
56
57
|
this.responses.push(new UnpinResponse(messageId, this.chatInfo, this.observability.traceId, this.action));
|
|
57
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Pins message after action execution is finished.
|
|
61
|
+
* 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.
|
|
62
|
+
* @param messageId Message id.
|
|
63
|
+
*/
|
|
64
|
+
pinMessage(messageId) {
|
|
65
|
+
this.responses.push(new PinResponse(messageId, this.chatInfo, this.observability.traceId, this.action));
|
|
66
|
+
}
|
|
58
67
|
/**
|
|
59
68
|
* Delays next responses by specified amount of time.
|
|
60
69
|
* @param delay Delay in milliseconds.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IActionState } from '../../types/actionState';
|
|
2
2
|
import { ChatContextInternal } from './chatContext';
|
|
3
|
-
import {
|
|
3
|
+
import { TextMessageSendingOptions } from '../../types/messageSendingOptions';
|
|
4
4
|
import { CommandAction } from '../actions/commandAction';
|
|
5
5
|
import { Seconds } from '../../types/timeValues';
|
|
6
6
|
import { BaseContextPropertiesToOmit } from './baseContext';
|
|
@@ -56,14 +56,14 @@ export declare class MessageContextInternal<TActionState extends IActionState> e
|
|
|
56
56
|
* @param text Message contents.
|
|
57
57
|
* @param options Message sending option.
|
|
58
58
|
*/
|
|
59
|
-
withImage: (name: string, quote?: string
|
|
59
|
+
withImage: (name: string, quote?: string) => import("../..").ICaptureController;
|
|
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
|
|
66
|
+
withVideo: (name: string, quote?: string) => import("../..").ICaptureController;
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
69
69
|
* Reply with text message to message that triggered this action after action execution is finished.
|
|
@@ -78,14 +78,14 @@ export declare class MessageContextInternal<TActionState extends IActionState> e
|
|
|
78
78
|
* @param text Message contents.
|
|
79
79
|
* @param options Message sending option.
|
|
80
80
|
*/
|
|
81
|
-
withImage: (name: string
|
|
81
|
+
withImage: (name: string) => import("../..").ICaptureController;
|
|
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
|
|
88
|
+
withVideo: (name: string) => import("../..").ICaptureController;
|
|
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/messageContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAKvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"messageContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/messageContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAKvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,C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AS,EAAE,UAAU,EACrB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,EACnC,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO;IA2BpB,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,cAAc;IAgBtB,YAAY;IAIZ,mBAAmB,CAAC,cAAc,EAAE,OAAO;IAK3C;;OAEG;IACH,KAAK;QACD;;;WAGG;;YAEC;;;;;eAKG;6BAEO,MAAM,UACJ,MAAM,YACJ,yBAAyB;YAEvC;;;;;eAKG;8BACe,MAAM,UAAU,MAAM;YAGxC;;;;;eAKG;8BACe,MAAM,UAAU,MAAM;;QAI5C;;;;;WAKG;yBACc,MAAM,YAAY,yBAAyB;QAE5D;;;;;WAKG;0BACe,MAAM;QAExB;;;;;WAKG;0BACe,MAAM;QAExB;;;;WAIG;8BACmB,aAAa;MAWrC;CACL"}
|
|
@@ -37,15 +37,15 @@ export class MessageContextInternal extends ChatContextInternal {
|
|
|
37
37
|
this.responses.push(response);
|
|
38
38
|
return this.createCaptureController(response);
|
|
39
39
|
}
|
|
40
|
-
replyWithImage(name, quote
|
|
40
|
+
replyWithImage(name, quote) {
|
|
41
41
|
const quotedPart = getQuotedText(this, quote);
|
|
42
|
-
const response = new ImageMessage({ source: resolve(`./content/${name}.png`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined)
|
|
42
|
+
const response = new ImageMessage({ source: resolve(`./content/${name}.png`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined));
|
|
43
43
|
this.responses.push(response);
|
|
44
44
|
return this.createCaptureController(response);
|
|
45
45
|
}
|
|
46
|
-
replyWithVideo(name, quote
|
|
46
|
+
replyWithVideo(name, quote) {
|
|
47
47
|
const quotedPart = getQuotedText(this, quote);
|
|
48
|
-
const response = new VideoMessage({ source: resolve(`./content/${name}.mp4`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined)
|
|
48
|
+
const response = new VideoMessage({ source: resolve(`./content/${name}.mp4`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined));
|
|
49
49
|
this.responses.push(response);
|
|
50
50
|
return this.createCaptureController(response);
|
|
51
51
|
}
|
|
@@ -78,14 +78,14 @@ export class MessageContextInternal extends ChatContextInternal {
|
|
|
78
78
|
* @param text Message contents.
|
|
79
79
|
* @param options Message sending option.
|
|
80
80
|
*/
|
|
81
|
-
withImage: (name, quote
|
|
81
|
+
withImage: (name, quote) => this.replyWithImage(name, quote ?? true),
|
|
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, quote
|
|
88
|
+
withVideo: (name, quote) => this.replyWithVideo(name, quote ?? true)
|
|
89
89
|
},
|
|
90
90
|
/**
|
|
91
91
|
* Reply with text message to message that triggered this action after action execution is finished.
|
|
@@ -100,14 +100,14 @@ export class MessageContextInternal extends ChatContextInternal {
|
|
|
100
100
|
* @param text Message contents.
|
|
101
101
|
* @param options Message sending option.
|
|
102
102
|
*/
|
|
103
|
-
withImage: (name
|
|
103
|
+
withImage: (name) => this.replyWithImage(name, false),
|
|
104
104
|
/**
|
|
105
105
|
* Reply with video/gif message to message that triggered this action after action execution is finished.
|
|
106
106
|
* 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.
|
|
107
107
|
* @param text Message contents.
|
|
108
108
|
* @param options Message sending option.
|
|
109
109
|
*/
|
|
110
|
-
withVideo: (name
|
|
110
|
+
withVideo: (name) => this.replyWithVideo(name, false),
|
|
111
111
|
/**
|
|
112
112
|
* React to the message that triggered this action after action execution is finished.
|
|
113
113
|
* 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.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IActionState } from '../../types/actionState';
|
|
2
|
-
import { TextMessageSendingOptions
|
|
2
|
+
import { TextMessageSendingOptions } from '../../types/messageSendingOptions';
|
|
3
3
|
import { ReplyCaptureAction } from '../actions/replyCaptureAction';
|
|
4
4
|
import { BaseContextInternal, BaseContextPropertiesToOmit } from './baseContext';
|
|
5
5
|
import { UserInfo } from '../../dtos/userInfo';
|
|
@@ -51,14 +51,14 @@ export declare class ReplyContextInternal<TParentActionState extends IActionStat
|
|
|
51
51
|
* @param text Message contents.
|
|
52
52
|
* @param options Message sending option.
|
|
53
53
|
*/
|
|
54
|
-
withImage: (name: string, quote?: string
|
|
54
|
+
withImage: (name: string, quote?: string) => import("../..").ICaptureController;
|
|
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
|
|
61
|
+
withVideo: (name: string, quote?: string) => import("../..").ICaptureController;
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
64
|
* Reply with text message to message that triggered this action after action execution is finished.
|
|
@@ -73,14 +73,14 @@ export declare class ReplyContextInternal<TParentActionState extends IActionStat
|
|
|
73
73
|
* @param text Message contents.
|
|
74
74
|
* @param options Message sending option.
|
|
75
75
|
*/
|
|
76
|
-
withImage: (name: string
|
|
76
|
+
withImage: (name: string) => import("../..").ICaptureController;
|
|
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
|
|
83
|
+
withVideo: (name: string) => import("../..").ICaptureController;
|
|
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replyContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/replyContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,
|
|
1
|
+
{"version":3,"file":"replyContext.d.ts","sourceRoot":"","sources":["../../../src/entities/context/replyContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EACH,mBAAmB,EACnB,2BAA2B,EAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACH,YAAY,EACZ,aAAa,EACb,OAAO,EACV,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,MAAM,MAAM,YAAY,CAAC,YAAY,SAAS,YAAY,IAAI,IAAI,CAC9D,oBAAoB,CAAC,YAAY,CAAC,EAChC,2BAA2B,GAC3B,WAAW,GACX,eAAe,GACf,gBAAgB,CACrB,CAAC;AAEF,qBAAa,oBAAoB,CAC7B,kBAAkB,SAAS,YAAY,CACzC,SAAQ,mBAAmB,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IACjE,4HAA4H;IAC5H,YAAY,EAAE,eAAe,EAAE,CAAM;IACrC,kDAAkD;IAClD,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,6BAA6B;IAC7B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;gBAG3B,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,UAAU,EACrB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,EAC9C,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO;IA2BpB,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,cAAc;IAgBtB;;OAEG;IACH,WAAW;IAIX;;OAEG;IACH,KAAK;QACD;;;WAGG;;YAEC;;;;;eAKG;6BAEO,MAAM,UACJ,MAAM,YACJ,yBAAyB;YAIvC;;;;;eAKG;8BACe,MAAM,UAAU,MAAM;YAIxC;;;;;eAKG;8BACe,MAAM,UAAU,MAAM;;QAK5C;;;;;WAKG;yBACc,MAAM,YAAY,yBAAyB;QAG5D;;;;;WAKG;0BACe,MAAM;QAIxB;;;;;WAKG;0BACe,MAAM;QAIxB;;;;WAIG;8BACmB,aAAa;MAWrC;CACL"}
|
|
@@ -33,15 +33,15 @@ export class ReplyContextInternal extends BaseContextInternal {
|
|
|
33
33
|
this.responses.push(response);
|
|
34
34
|
return this.createCaptureController(response);
|
|
35
35
|
}
|
|
36
|
-
replyWithImage(name, quote
|
|
36
|
+
replyWithImage(name, quote) {
|
|
37
37
|
const quotedPart = getQuotedText(this, quote);
|
|
38
|
-
const response = new ImageMessage({ source: resolve(`./content/${name}.png`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined)
|
|
38
|
+
const response = new ImageMessage({ source: resolve(`./content/${name}.png`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined));
|
|
39
39
|
this.responses.push(response);
|
|
40
40
|
return this.createCaptureController(response);
|
|
41
41
|
}
|
|
42
|
-
replyWithVideo(name, quote
|
|
42
|
+
replyWithVideo(name, quote) {
|
|
43
43
|
const quotedPart = getQuotedText(this, quote);
|
|
44
|
-
const response = new VideoMessage({ source: resolve(`./content/${name}.mp4`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined)
|
|
44
|
+
const response = new VideoMessage({ source: resolve(`./content/${name}.mp4`) }, this.chatInfo, this.observability.traceId, this.action, new ReplyInfo(this.messageInfo.id, quote ? quotedPart : undefined));
|
|
45
45
|
this.responses.push(response);
|
|
46
46
|
return this.createCaptureController(response);
|
|
47
47
|
}
|
|
@@ -75,8 +75,8 @@ export class ReplyContextInternal extends BaseContextInternal {
|
|
|
75
75
|
* @param text Message contents.
|
|
76
76
|
* @param options Message sending option.
|
|
77
77
|
*/
|
|
78
|
-
withImage: (name, quote
|
|
79
|
-
return this.replyWithImage(name, quote ?? true
|
|
78
|
+
withImage: (name, quote) => {
|
|
79
|
+
return this.replyWithImage(name, quote ?? true);
|
|
80
80
|
},
|
|
81
81
|
/**
|
|
82
82
|
* Reply with video/gif message to message that triggered this action after action execution is finished.
|
|
@@ -84,8 +84,8 @@ export class ReplyContextInternal extends BaseContextInternal {
|
|
|
84
84
|
* @param text Message contents.
|
|
85
85
|
* @param options Message sending option.
|
|
86
86
|
*/
|
|
87
|
-
withVideo: (name, quote
|
|
88
|
-
return this.replyWithVideo(name, quote ?? true
|
|
87
|
+
withVideo: (name, quote) => {
|
|
88
|
+
return this.replyWithVideo(name, quote ?? true);
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
/**
|
|
@@ -103,8 +103,8 @@ export class ReplyContextInternal extends BaseContextInternal {
|
|
|
103
103
|
* @param text Message contents.
|
|
104
104
|
* @param options Message sending option.
|
|
105
105
|
*/
|
|
106
|
-
withImage: (name
|
|
107
|
-
return this.replyWithImage(name, false
|
|
106
|
+
withImage: (name) => {
|
|
107
|
+
return this.replyWithImage(name, false);
|
|
108
108
|
},
|
|
109
109
|
/**
|
|
110
110
|
* Reply with video/gif message to message that triggered this action after action execution is finished.
|
|
@@ -112,8 +112,8 @@ export class ReplyContextInternal extends BaseContextInternal {
|
|
|
112
112
|
* @param text Message contents.
|
|
113
113
|
* @param options Message sending option.
|
|
114
114
|
*/
|
|
115
|
-
withVideo: (name
|
|
116
|
-
return this.replyWithVideo(name, false
|
|
115
|
+
withVideo: (name) => {
|
|
116
|
+
return this.replyWithVideo(name, false);
|
|
117
117
|
},
|
|
118
118
|
/**
|
|
119
119
|
* React to the message that triggered this action after action execution is finished.
|
|
@@ -16,7 +16,6 @@ export declare class TelegramApiService {
|
|
|
16
16
|
constructor(botName: string, telegram: TelegramApiClient, storage: IStorageClient, eventEmitter: TypedEventEmitter, captureRegistrationCallback: (capture: IReplyCapture, parentMessageId: number, chatInfo: ChatInfo, traceId: TraceId) => void);
|
|
17
17
|
enqueueBatchedResponses(responses: BotResponse[]): void;
|
|
18
18
|
flushResponses(): void;
|
|
19
|
-
private pinIfShould;
|
|
20
19
|
private processResponse;
|
|
21
20
|
private sendApiRequest;
|
|
22
21
|
}
|
|
@@ -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,
|
|
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;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,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;AAIlE,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,CAYxB;gBAGE,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,iBAAiB,EAC/B,2BAA2B,EAAE,CACzB,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,KACf,IAAI;IAcb,uBAAuB,CAAC,SAAS,EAAE,WAAW,EAAE;IA4DhD,cAAc;YAYA,eAAe;YAef,cAAc;CAoH/B"}
|
|
@@ -38,27 +38,30 @@ export class TelegramApiService {
|
|
|
38
38
|
try {
|
|
39
39
|
await this.processResponse(response);
|
|
40
40
|
}
|
|
41
|
-
catch (
|
|
42
|
-
const error =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
catch (reason) {
|
|
42
|
+
const error = reason instanceof Error
|
|
43
|
+
? reason
|
|
44
|
+
: new Error('Unknown error');
|
|
45
|
+
if ('quotelessReply' in response &&
|
|
46
|
+
'message' in error &&
|
|
47
|
+
error.message.includes(TELEGRAM_ERROR_QUOTE_INVALID)) {
|
|
48
|
+
this.eventEmitter.emit(BotEventType.error, {
|
|
49
|
+
error: new Error('Quote error recieved, retrying without quote'),
|
|
50
|
+
traceId: response.traceId
|
|
51
|
+
});
|
|
52
|
+
try {
|
|
53
|
+
await this.processResponse(response.quotelessReply);
|
|
54
|
+
}
|
|
55
|
+
catch (reason) {
|
|
56
|
+
const error = reason instanceof Error
|
|
57
|
+
? reason
|
|
58
|
+
: new Error('Unknown error');
|
|
46
59
|
this.eventEmitter.emit(BotEventType.error, {
|
|
47
|
-
error
|
|
60
|
+
error,
|
|
48
61
|
traceId: response.traceId
|
|
49
62
|
});
|
|
50
|
-
try {
|
|
51
|
-
await this.processResponse(response, true);
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
const error = e;
|
|
55
|
-
this.eventEmitter.emit(BotEventType.error, {
|
|
56
|
-
error,
|
|
57
|
-
traceId: response.traceId
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return;
|
|
61
63
|
}
|
|
64
|
+
return;
|
|
62
65
|
}
|
|
63
66
|
this.eventEmitter.emit(BotEventType.error, {
|
|
64
67
|
error,
|
|
@@ -81,34 +84,15 @@ export class TelegramApiService {
|
|
|
81
84
|
});
|
|
82
85
|
});
|
|
83
86
|
}
|
|
84
|
-
async
|
|
85
|
-
|
|
86
|
-
this.eventEmitter.emit(BotEventType.apiRequestSending, {
|
|
87
|
-
response: null,
|
|
88
|
-
telegramMethod: this.methodMap['pin'],
|
|
89
|
-
traceId: response.traceId
|
|
90
|
-
});
|
|
91
|
-
await this.telegram.pinChatMessage(response.chatInfo.id, message.message_id, { disable_notification: true });
|
|
92
|
-
this.eventEmitter.emit(BotEventType.apiRequestSent, {
|
|
93
|
-
response: null,
|
|
94
|
-
telegramMethod: this.methodMap['pin'],
|
|
95
|
-
traceId: response.traceId
|
|
96
|
-
});
|
|
97
|
-
await this.storage.updateStateFor(response.action, response.chatInfo.id, (state) => {
|
|
98
|
-
state.pinnedMessages.push(message.message_id);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
async processResponse(response, ignoreQuote = false) {
|
|
103
|
-
const sentMessage = await this.sendApiRequest(response, ignoreQuote);
|
|
87
|
+
async processResponse(response) {
|
|
88
|
+
const sentMessage = await this.sendApiRequest(response);
|
|
104
89
|
if (sentMessage && 'content' in response) {
|
|
105
|
-
await this.pinIfShould(response, sentMessage);
|
|
106
90
|
for (const capture of response.captures) {
|
|
107
91
|
this.captureRegistrationCallback(capture, sentMessage.message_id, response.chatInfo, response.traceId);
|
|
108
92
|
}
|
|
109
93
|
}
|
|
110
94
|
}
|
|
111
|
-
async sendApiRequest(response
|
|
95
|
+
async sendApiRequest(response) {
|
|
112
96
|
this.eventEmitter.emit(BotEventType.apiRequestSending, {
|
|
113
97
|
response,
|
|
114
98
|
telegramMethod: this.methodMap[response.kind],
|
|
@@ -121,37 +105,29 @@ export class TelegramApiService {
|
|
|
121
105
|
reply_parameters: response.replyInfo
|
|
122
106
|
? {
|
|
123
107
|
message_id: response.replyInfo.id,
|
|
124
|
-
quote:
|
|
125
|
-
? undefined
|
|
126
|
-
: response.replyInfo.quote
|
|
108
|
+
quote: response.replyInfo.quote
|
|
127
109
|
}
|
|
128
110
|
: undefined,
|
|
129
111
|
parse_mode: 'MarkdownV2',
|
|
130
112
|
link_preview_options: {
|
|
131
113
|
is_disabled: response.disableWebPreview
|
|
132
114
|
},
|
|
133
|
-
reply_markup:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
: undefined
|
|
115
|
+
reply_markup: {
|
|
116
|
+
inline_keyboard: response.keyboard ?? []
|
|
117
|
+
}
|
|
138
118
|
});
|
|
139
119
|
case 'image':
|
|
140
|
-
return await this.telegram.sendPhoto(response.chatInfo.id, response.content,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
: undefined);
|
|
120
|
+
return await this.telegram.sendPhoto(response.chatInfo.id, response.content, {
|
|
121
|
+
// @ts-expect-error reply_parameters is bugged in sendPhoto,
|
|
122
|
+
// fallback to reply_to_message_id which is deprecated but still functional
|
|
123
|
+
reply_to_message_id: response.replyInfo?.id
|
|
124
|
+
});
|
|
147
125
|
case 'video':
|
|
148
|
-
return await this.telegram.sendVideo(response.chatInfo.id, response.content,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
: undefined);
|
|
126
|
+
return await this.telegram.sendVideo(response.chatInfo.id, response.content, {
|
|
127
|
+
// @ts-expect-error reply_parameters is bugged in sendPhoto,
|
|
128
|
+
// fallback to reply_to_message_id which is deprecated but still functional
|
|
129
|
+
reply_to_message_id: response.replyInfo?.id
|
|
130
|
+
});
|
|
155
131
|
case 'react':
|
|
156
132
|
await this.telegram.setMessageReaction(response.chatInfo.id, response.messageId, [
|
|
157
133
|
{
|
|
@@ -166,6 +142,12 @@ export class TelegramApiService {
|
|
|
166
142
|
state.pinnedMessages = state.pinnedMessages.filter((x) => x != response.messageId);
|
|
167
143
|
});
|
|
168
144
|
return null;
|
|
145
|
+
case 'pin':
|
|
146
|
+
await this.telegram.pinChatMessage(response.chatInfo.id, response.messageId, { disable_notification: true });
|
|
147
|
+
await this.storage.updateStateFor(response.action, response.chatInfo.id, (state) => {
|
|
148
|
+
state.pinnedMessages.push(response.messageId);
|
|
149
|
+
});
|
|
150
|
+
return null;
|
|
169
151
|
case 'inlineQuery':
|
|
170
152
|
await this.telegram.answerInlineQuery(response.queryId, response.queryResults, { cache_time: 0 });
|
|
171
153
|
return null;
|
package/dist/types/response.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ import { IReplyCapture } from './capture';
|
|
|
10
10
|
import { ReplyInfo } from '../dtos/replyInfo';
|
|
11
11
|
import { TraceId } from './trace';
|
|
12
12
|
import { IAction } from './action';
|
|
13
|
+
import { PinResponse } from '../dtos/responses/pin';
|
|
13
14
|
export declare const BotResponseTypes: {
|
|
15
|
+
readonly pin: "pin";
|
|
14
16
|
readonly unpin: "unpin";
|
|
15
17
|
readonly text: "text";
|
|
16
18
|
readonly image: "image";
|
|
@@ -19,7 +21,7 @@ export declare const BotResponseTypes: {
|
|
|
19
21
|
readonly delay: "delay";
|
|
20
22
|
readonly inlineQuery: "inlineQuery";
|
|
21
23
|
};
|
|
22
|
-
export type BotResponse = UnpinResponse | Reaction | TextMessage | VideoMessage | DelayResponse | InlineQueryResponse | ImageMessage;
|
|
24
|
+
export type BotResponse = UnpinResponse | Reaction | TextMessage | VideoMessage | DelayResponse | InlineQueryResponse | ImageMessage | PinResponse;
|
|
23
25
|
export interface IChatResponse {
|
|
24
26
|
readonly kind: keyof typeof BotResponseTypes;
|
|
25
27
|
readonly chatInfo: ChatInfo;
|
|
@@ -31,7 +33,7 @@ export interface IReplyResponse extends IChatResponse {
|
|
|
31
33
|
readonly captures: IReplyCapture[];
|
|
32
34
|
readonly replyInfo: ReplyInfo | undefined;
|
|
33
35
|
readonly disableWebPreview: boolean;
|
|
34
|
-
|
|
36
|
+
get quotelessReply(): IReplyResponse;
|
|
35
37
|
}
|
|
36
38
|
export interface IReplyResponseWithContent<TType> extends IReplyResponse {
|
|
37
39
|
readonly content: TType;
|
|
@@ -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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