chz-telegram-bot 0.3.14 → 0.3.15
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/chatInfo.d.ts +10 -1
- package/dist/dtos/chatInfo.d.ts.map +1 -1
- package/dist/dtos/chatInfo.js +11 -5
- package/dist/dtos/commandTriggerCheckResult.d.ts +5 -5
- package/dist/dtos/commandTriggerCheckResult.d.ts.map +1 -1
- package/dist/dtos/commandTriggerCheckResult.js +4 -4
- package/dist/dtos/cooldownInfo.d.ts +9 -3
- package/dist/dtos/cooldownInfo.d.ts.map +1 -1
- package/dist/dtos/cooldownInfo.js +5 -1
- package/dist/dtos/incomingMessage.d.ts +1 -1
- package/dist/dtos/incomingMessage.d.ts.map +1 -1
- package/dist/dtos/incomingMessage.js +2 -2
- package/dist/dtos/incomingQuery.d.ts.map +1 -1
- package/dist/dtos/messageInfo.d.ts +21 -0
- package/dist/dtos/messageInfo.d.ts.map +1 -0
- package/dist/dtos/messageInfo.js +24 -0
- package/dist/dtos/userInfo.d.ts +12 -0
- package/dist/dtos/userInfo.d.ts.map +1 -0
- package/dist/dtos/userInfo.js +16 -0
- package/dist/entities/actions/commandAction.d.ts +2 -2
- package/dist/entities/actions/commandAction.d.ts.map +1 -1
- package/dist/entities/actions/commandAction.js +7 -7
- package/dist/entities/actions/inlineQueryAction.d.ts +2 -2
- package/dist/entities/actions/inlineQueryAction.d.ts.map +1 -1
- package/dist/entities/actions/replyCaptureAction.d.ts +4 -4
- package/dist/entities/actions/replyCaptureAction.d.ts.map +1 -1
- package/dist/entities/actions/replyCaptureAction.js +4 -4
- package/dist/entities/actions/scheduledAction.d.ts +2 -2
- package/dist/entities/actions/scheduledAction.d.ts.map +1 -1
- package/dist/entities/context/baseContext.d.ts +2 -1
- package/dist/entities/context/baseContext.d.ts.map +1 -1
- package/dist/entities/context/baseContext.js +3 -3
- package/dist/entities/context/chatContext.d.ts +3 -2
- package/dist/entities/context/chatContext.d.ts.map +1 -1
- package/dist/entities/context/chatContext.js +3 -3
- package/dist/entities/context/inlineQueryContext.d.ts +3 -2
- package/dist/entities/context/inlineQueryContext.d.ts.map +1 -1
- package/dist/entities/context/inlineQueryContext.js +3 -3
- package/dist/entities/context/messageContext.d.ts +11 -15
- package/dist/entities/context/messageContext.d.ts.map +1 -1
- package/dist/entities/context/messageContext.js +15 -20
- package/dist/entities/context/replyContext.d.ts +9 -15
- package/dist/entities/context/replyContext.d.ts.map +1 -1
- package/dist/entities/context/replyContext.js +12 -20
- package/dist/helpers/mapUtils.d.ts +9 -2
- package/dist/helpers/mapUtils.d.ts.map +1 -1
- package/dist/helpers/mapUtils.js +1 -1
- package/dist/services/actionProcessors/baseProcessor.d.ts +2 -2
- package/dist/services/actionProcessors/baseProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/commandActionProcessor.d.ts +1 -0
- package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/commandActionProcessor.js +18 -19
- package/dist/services/actionProcessors/inlineQueryActionProcessor.js +1 -1
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/scheduledActionProcessor.js +2 -2
- package/dist/types/action.d.ts +2 -2
- package/dist/types/action.d.ts.map +1 -1
- package/dist/types/capture.d.ts +3 -3
- package/dist/types/capture.d.ts.map +1 -1
- package/dtos/chatInfo.ts +10 -9
- package/dtos/commandTriggerCheckResult.ts +5 -15
- package/dtos/cooldownInfo.ts +6 -1
- package/dtos/incomingMessage.ts +7 -2
- package/dtos/incomingQuery.ts +4 -12
- package/dtos/messageInfo.ts +17 -0
- package/dtos/userInfo.ts +8 -0
- package/entities/actions/commandAction.ts +11 -11
- package/entities/actions/inlineQueryAction.ts +2 -2
- package/entities/actions/replyCaptureAction.ts +9 -9
- package/entities/actions/scheduledAction.ts +2 -2
- package/entities/context/baseContext.ts +11 -1
- package/entities/context/chatContext.ts +16 -5
- package/entities/context/inlineQueryContext.ts +10 -2
- package/entities/context/messageContext.ts +24 -25
- package/entities/context/replyContext.ts +26 -25
- package/helpers/mapUtils.ts +15 -2
- package/package.json +1 -1
- package/services/actionProcessors/baseProcessor.ts +3 -3
- package/services/actionProcessors/commandActionProcessor.ts +43 -21
- package/services/actionProcessors/inlineQueryActionProcessor.ts +3 -3
- package/services/actionProcessors/scheduledActionProcessor.ts +7 -4
- package/types/action.ts +2 -2
- package/types/capture.ts +5 -3
- package/chz-telegram-bot-0.3.14.tgz +0 -0
package/dist/dtos/chatInfo.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import { IncomingMessage } from './incomingMessage';
|
|
1
2
|
export declare class ChatInfo {
|
|
2
3
|
/** Id of a chat that action is executed in. */
|
|
3
4
|
readonly id: number;
|
|
4
5
|
/** Name of a chat that action is executed in. */
|
|
5
6
|
readonly name: string;
|
|
6
|
-
|
|
7
|
+
/** Last 100 messages in chat where action is executed */
|
|
8
|
+
readonly messageHistory: IncomingMessage[];
|
|
9
|
+
constructor(
|
|
10
|
+
/** Id of a chat that action is executed in. */
|
|
11
|
+
id: number,
|
|
12
|
+
/** Name of a chat that action is executed in. */
|
|
13
|
+
name: string,
|
|
14
|
+
/** Last 100 messages in chat where action is executed */
|
|
15
|
+
messageHistory: IncomingMessage[]);
|
|
7
16
|
}
|
|
8
17
|
//# sourceMappingURL=chatInfo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatInfo.d.ts","sourceRoot":"","sources":["../../dtos/chatInfo.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;
|
|
1
|
+
{"version":3,"file":"chatInfo.d.ts","sourceRoot":"","sources":["../../dtos/chatInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qBAAa,QAAQ;IAEb,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,EAAE,MAAM;IACnB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,yDAAyD;IACzD,QAAQ,CAAC,cAAc,EAAE,eAAe,EAAE;;IAL1C,+CAA+C;IACtC,EAAE,EAAE,MAAM;IACnB,iDAAiD;IACxC,IAAI,EAAE,MAAM;IACrB,yDAAyD;IAChD,cAAc,EAAE,eAAe,EAAE;CAEjD"}
|
package/dist/dtos/chatInfo.js
CHANGED
|
@@ -2,13 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChatInfo = void 0;
|
|
4
4
|
class ChatInfo {
|
|
5
|
-
/** Id of a chat that action is executed in. */
|
|
6
5
|
id;
|
|
7
|
-
/** Name of a chat that action is executed in. */
|
|
8
6
|
name;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
messageHistory;
|
|
8
|
+
constructor(
|
|
9
|
+
/** Id of a chat that action is executed in. */
|
|
10
|
+
id,
|
|
11
|
+
/** Name of a chat that action is executed in. */
|
|
12
|
+
name,
|
|
13
|
+
/** Last 100 messages in chat where action is executed */
|
|
14
|
+
messageHistory) {
|
|
15
|
+
this.id = id;
|
|
16
|
+
this.name = name;
|
|
17
|
+
this.messageHistory = messageHistory;
|
|
12
18
|
}
|
|
13
19
|
}
|
|
14
20
|
exports.ChatInfo = ChatInfo;
|
|
@@ -8,14 +8,14 @@ declare const _SkipTriggerReasonsObject: {
|
|
|
8
8
|
};
|
|
9
9
|
export type SkipTriggerReasons = keyof typeof _SkipTriggerReasonsObject;
|
|
10
10
|
export declare class CommandTriggerCheckResult {
|
|
11
|
-
static DontTriggerAndSkipCooldown(reason: SkipTriggerReasons): CommandTriggerCheckResult;
|
|
12
|
-
static DoNotTrigger(reason: SkipTriggerReasons): CommandTriggerCheckResult;
|
|
13
|
-
static Trigger(): CommandTriggerCheckResult;
|
|
14
11
|
readonly shouldExecute: boolean;
|
|
15
12
|
readonly matchResults: RegExpExecArray[];
|
|
16
13
|
readonly skipCooldown: boolean;
|
|
17
|
-
readonly reason
|
|
18
|
-
|
|
14
|
+
readonly reason?: SkipTriggerReasons | undefined;
|
|
15
|
+
static DontTriggerAndSkipCooldown(reason: SkipTriggerReasons): CommandTriggerCheckResult;
|
|
16
|
+
static DoNotTrigger(reason: SkipTriggerReasons): CommandTriggerCheckResult;
|
|
17
|
+
static Trigger(): CommandTriggerCheckResult;
|
|
18
|
+
constructor(shouldExecute: boolean, matchResults: RegExpExecArray[], skipCooldown: boolean, reason?: SkipTriggerReasons | undefined);
|
|
19
19
|
mergeWith(other: CommandTriggerCheckResult): CommandTriggerCheckResult;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandTriggerCheckResult.d.ts","sourceRoot":"","sources":["../../dtos/commandTriggerCheckResult.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,yBAAyB;;;;;;;CAOrB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,yBAAyB,CAAC;AAExE,qBAAa,yBAAyB;
|
|
1
|
+
{"version":3,"file":"commandTriggerCheckResult.d.ts","sourceRoot":"","sources":["../../dtos/commandTriggerCheckResult.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,yBAAyB;;;;;;;CAOrB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,yBAAyB,CAAC;AAExE,qBAAa,yBAAyB;IAY9B,QAAQ,CAAC,aAAa,EAAE,OAAO;IAC/B,QAAQ,CAAC,YAAY,EAAE,eAAe,EAAE;IACxC,QAAQ,CAAC,YAAY,EAAE,OAAO;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB;IAdxC,MAAM,CAAC,0BAA0B,CAAC,MAAM,EAAE,kBAAkB;IAG5D,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,kBAAkB;IAG9C,MAAM,CAAC,OAAO;gBAKD,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,eAAe,EAAE,EAC/B,YAAY,EAAE,OAAO,EACrB,MAAM,CAAC,EAAE,kBAAkB,YAAA;IAGxC,SAAS,CAAC,KAAK,EAAE,yBAAyB;CAQ7C"}
|
|
@@ -10,6 +10,10 @@ const _SkipTriggerReasonsObject = {
|
|
|
10
10
|
Other: 'Other'
|
|
11
11
|
};
|
|
12
12
|
class CommandTriggerCheckResult {
|
|
13
|
+
shouldExecute;
|
|
14
|
+
matchResults;
|
|
15
|
+
skipCooldown;
|
|
16
|
+
reason;
|
|
13
17
|
static DontTriggerAndSkipCooldown(reason) {
|
|
14
18
|
return new CommandTriggerCheckResult(false, [], true, reason);
|
|
15
19
|
}
|
|
@@ -19,10 +23,6 @@ class CommandTriggerCheckResult {
|
|
|
19
23
|
static Trigger() {
|
|
20
24
|
return new CommandTriggerCheckResult(true, [], false);
|
|
21
25
|
}
|
|
22
|
-
shouldExecute;
|
|
23
|
-
matchResults;
|
|
24
|
-
skipCooldown;
|
|
25
|
-
reason;
|
|
26
26
|
constructor(shouldExecute, matchResults, skipCooldown, reason) {
|
|
27
27
|
this.shouldExecute = shouldExecute;
|
|
28
28
|
this.matchResults = matchResults;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Seconds } from '../types/timeValues';
|
|
2
2
|
export declare class CooldownInfo {
|
|
3
|
-
seconds
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/** New one-time cooldown in seconds */
|
|
4
|
+
readonly seconds: Seconds;
|
|
5
|
+
/** Cooldown message to be shown */
|
|
6
|
+
readonly message: string | undefined;
|
|
7
|
+
constructor(
|
|
8
|
+
/** New one-time cooldown in seconds */
|
|
9
|
+
seconds: Seconds,
|
|
10
|
+
/** Cooldown message to be shown */
|
|
11
|
+
message: string | undefined);
|
|
6
12
|
}
|
|
7
13
|
//# sourceMappingURL=cooldownInfo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cooldownInfo.d.ts","sourceRoot":"","sources":["../../dtos/cooldownInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,YAAY;
|
|
1
|
+
{"version":3,"file":"cooldownInfo.d.ts","sourceRoot":"","sources":["../../dtos/cooldownInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,YAAY;IAEjB,uCAAuC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO;IACzB,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS;;IAHpC,uCAAuC;IAC9B,OAAO,EAAE,OAAO;IACzB,mCAAmC;IAC1B,OAAO,EAAE,MAAM,GAAG,SAAS;CAE3C"}
|
|
@@ -4,7 +4,11 @@ exports.CooldownInfo = void 0;
|
|
|
4
4
|
class CooldownInfo {
|
|
5
5
|
seconds;
|
|
6
6
|
message;
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(
|
|
8
|
+
/** New one-time cooldown in seconds */
|
|
9
|
+
seconds,
|
|
10
|
+
/** Cooldown message to be shown */
|
|
11
|
+
message) {
|
|
8
12
|
this.seconds = seconds;
|
|
9
13
|
this.message = message;
|
|
10
14
|
}
|
|
@@ -12,6 +12,6 @@ export declare class IncomingMessage {
|
|
|
12
12
|
readonly replyToMessageId: number | undefined;
|
|
13
13
|
readonly updateObject: TelegrafContextMessage;
|
|
14
14
|
private detectMessageType;
|
|
15
|
-
constructor(ctxMessage: TelegrafContextMessage, botName: string);
|
|
15
|
+
constructor(ctxMessage: TelegrafContextMessage, botName: string, history: IncomingMessage[]);
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=incomingMessage.d.ts.map
|
|
@@ -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,O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gB,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9C,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAC;IAE9C,OAAO,CAAC,iBAAiB;gBAqBrB,UAAU,EAAE,sBAAsB,EAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,eAAe,EAAE;CA6BjC"}
|
|
@@ -43,7 +43,7 @@ class IncomingMessage {
|
|
|
43
43
|
return messageTypes_1.MessageType.Location;
|
|
44
44
|
return messageTypes_1.MessageType.Unknown;
|
|
45
45
|
}
|
|
46
|
-
constructor(ctxMessage, botName) {
|
|
46
|
+
constructor(ctxMessage, botName, history) {
|
|
47
47
|
this.traceId = (0, traceFactory_1.createTrace)(this, botName, (0, crypto_1.randomInt)(10000, 99999).toString());
|
|
48
48
|
this.messageId = ctxMessage.message_id;
|
|
49
49
|
this.replyToMessageId =
|
|
@@ -59,7 +59,7 @@ class IncomingMessage {
|
|
|
59
59
|
: '';
|
|
60
60
|
this.chatInfo = new chatInfo_1.ChatInfo(ctxMessage.chat.id, 'title' in ctxMessage.chat
|
|
61
61
|
? `${ctxMessage.chat.title} ${ctxMessage.chat.id}`
|
|
62
|
-
: 'DM');
|
|
62
|
+
: 'DM', history);
|
|
63
63
|
this.type = this.detectMessageType(ctxMessage);
|
|
64
64
|
this.updateObject = ctxMessage;
|
|
65
65
|
}
|
|
@@ -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;
|
|
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;IAIxB,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO;IAN7B,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;gBAG7B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO;CAIhC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MessageTypeValue, TelegrafContextMessage } from '../types/messageTypes';
|
|
2
|
+
export declare class MessageInfo {
|
|
3
|
+
/** Id of a message that triggered this action. */
|
|
4
|
+
readonly id: number;
|
|
5
|
+
/** Text of a message that triggered this action. */
|
|
6
|
+
readonly text: string;
|
|
7
|
+
/** Type of message being received */
|
|
8
|
+
readonly type: MessageTypeValue;
|
|
9
|
+
/** Message object recieved from Telegram */
|
|
10
|
+
readonly telegramUpdateObject: TelegrafContextMessage;
|
|
11
|
+
constructor(
|
|
12
|
+
/** Id of a message that triggered this action. */
|
|
13
|
+
id: number,
|
|
14
|
+
/** Text of a message that triggered this action. */
|
|
15
|
+
text: string,
|
|
16
|
+
/** Type of message being received */
|
|
17
|
+
type: MessageTypeValue,
|
|
18
|
+
/** Message object recieved from Telegram */
|
|
19
|
+
telegramUpdateObject: TelegrafContextMessage);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=messageInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageInfo.d.ts","sourceRoot":"","sources":["../../dtos/messageInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,sBAAsB,EACzB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,WAAW;IAEhB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,EAAE,MAAM;IACnB,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB;IAC/B,4CAA4C;IAC5C,QAAQ,CAAC,oBAAoB,EAAE,sBAAsB;;IAPrD,kDAAkD;IACzC,EAAE,EAAE,MAAM;IACnB,oDAAoD;IAC3C,IAAI,EAAE,MAAM;IACrB,qCAAqC;IAC5B,IAAI,EAAE,gBAAgB;IAC/B,4CAA4C;IACnC,oBAAoB,EAAE,sBAAsB;CAE5D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageInfo = void 0;
|
|
4
|
+
class MessageInfo {
|
|
5
|
+
id;
|
|
6
|
+
text;
|
|
7
|
+
type;
|
|
8
|
+
telegramUpdateObject;
|
|
9
|
+
constructor(
|
|
10
|
+
/** Id of a message that triggered this action. */
|
|
11
|
+
id,
|
|
12
|
+
/** Text of a message that triggered this action. */
|
|
13
|
+
text,
|
|
14
|
+
/** Type of message being received */
|
|
15
|
+
type,
|
|
16
|
+
/** Message object recieved from Telegram */
|
|
17
|
+
telegramUpdateObject) {
|
|
18
|
+
this.id = id;
|
|
19
|
+
this.text = text;
|
|
20
|
+
this.type = type;
|
|
21
|
+
this.telegramUpdateObject = telegramUpdateObject;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.MessageInfo = MessageInfo;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class UserInfo {
|
|
2
|
+
/** Id of a user that sent a message that triggered this action. */
|
|
3
|
+
readonly id: number;
|
|
4
|
+
/** Name of a user that sent a message that triggered this action. */
|
|
5
|
+
readonly name: string;
|
|
6
|
+
constructor(
|
|
7
|
+
/** Id of a user that sent a message that triggered this action. */
|
|
8
|
+
id: number,
|
|
9
|
+
/** Name of a user that sent a message that triggered this action. */
|
|
10
|
+
name: string);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=userInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userInfo.d.ts","sourceRoot":"","sources":["../../dtos/userInfo.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IAEb,mEAAmE;IACnE,QAAQ,CAAC,EAAE,EAAE,MAAM;IACnB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM;;IAHrB,mEAAmE;IAC1D,EAAE,EAAE,MAAM;IACnB,qEAAqE;IAC5D,IAAI,EAAE,MAAM;CAE5B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserInfo = void 0;
|
|
4
|
+
class UserInfo {
|
|
5
|
+
id;
|
|
6
|
+
name;
|
|
7
|
+
constructor(
|
|
8
|
+
/** Id of a user that sent a message that triggered this action. */
|
|
9
|
+
id,
|
|
10
|
+
/** Name of a user that sent a message that triggered this action. */
|
|
11
|
+
name) {
|
|
12
|
+
this.id = id;
|
|
13
|
+
this.name = name;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.UserInfo = UserInfo;
|
|
@@ -2,7 +2,7 @@ import { CommandHandler } from '../../types/handlers';
|
|
|
2
2
|
import { CommandCondition } from '../../types/commandCondition';
|
|
3
3
|
import { IActionState } from '../../types/actionState';
|
|
4
4
|
import { IActionWithState, ActionKey } from '../../types/action';
|
|
5
|
-
import {
|
|
5
|
+
import { MessageContextInternal } from '../context/messageContext';
|
|
6
6
|
import { CommandTrigger } from '../../types/commandTrigger';
|
|
7
7
|
import { Sema as Semaphore } from 'async-sema';
|
|
8
8
|
import { CooldownInfo } from '../../dtos/cooldownInfo';
|
|
@@ -23,7 +23,7 @@ export declare class CommandAction<TActionState extends IActionState> implements
|
|
|
23
23
|
readonly maxAllowedSimultaniousExecutions: number;
|
|
24
24
|
lastCustomCooldown: Seconds | undefined;
|
|
25
25
|
constructor(trigger: CommandTrigger | CommandTrigger[], handler: CommandHandler<TActionState>, name: string, active: boolean, cooldownInfo: CooldownInfo, chatsBlacklist: number[], allowedUsers: number[], maxAllowedSimultaniousExecutions: number, condition: CommandCondition<TActionState>, stateConstructor: () => TActionState, readmeFactory: (botName: string) => string);
|
|
26
|
-
exec(ctx:
|
|
26
|
+
exec(ctx: MessageContextInternal<TActionState>): Promise<import("../../types/response").BotResponse[]>;
|
|
27
27
|
private checkIfShouldBeExecuted;
|
|
28
28
|
private checkTrigger;
|
|
29
29
|
}
|
|
@@ -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;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,
|
|
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;AAGhE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,qBAAa,aAAa,CAAC,YAAY,SAAS,YAAY,CACxD,YAAW,gBAAgB,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 -62,7 +62,7 @@ class CommandAction {
|
|
|
62
62
|
if (!shouldExecute) {
|
|
63
63
|
if (reason == 'OnCooldown' && this.cooldownInfo.message)
|
|
64
64
|
return [
|
|
65
|
-
new textMessage_1.TextMessage(this.cooldownInfo.message, ctx.chatInfo, ctx.traceId, this, new replyInfo_1.ReplyInfo(ctx.
|
|
65
|
+
new textMessage_1.TextMessage(this.cooldownInfo.message, ctx.chatInfo, ctx.traceId, this, new replyInfo_1.ReplyInfo(ctx.messageInfo.id))
|
|
66
66
|
];
|
|
67
67
|
return noop_1.Noop.NoResponse;
|
|
68
68
|
}
|
|
@@ -87,10 +87,10 @@ class CommandAction {
|
|
|
87
87
|
const triggerCheckResult = this.checkTrigger(ctx, trigger);
|
|
88
88
|
if (!triggerCheckResult.shouldExecute)
|
|
89
89
|
return triggerCheckResult;
|
|
90
|
-
if (!ctx.
|
|
90
|
+
if (!ctx.userInfo.id)
|
|
91
91
|
return commandTriggerCheckResult_1.CommandTriggerCheckResult.DontTriggerAndSkipCooldown('UserIdMissing');
|
|
92
92
|
const isUserAllowed = this.allowedUsers.length == 0 ||
|
|
93
|
-
this.allowedUsers.includes(ctx.
|
|
93
|
+
this.allowedUsers.includes(ctx.userInfo.id);
|
|
94
94
|
if (!isUserAllowed)
|
|
95
95
|
return commandTriggerCheckResult_1.CommandTriggerCheckResult.DontTriggerAndSkipCooldown('UserForbidden');
|
|
96
96
|
const lastExecutedDate = (0, moment_1.default)(state.lastExecutedDate);
|
|
@@ -104,21 +104,21 @@ class CommandAction {
|
|
|
104
104
|
return triggerCheckResult;
|
|
105
105
|
}
|
|
106
106
|
checkTrigger(ctx, trigger) {
|
|
107
|
-
if (trigger == messageTypes_1.MessageType.Any || trigger == ctx.
|
|
107
|
+
if (trigger == messageTypes_1.MessageType.Any || trigger == ctx.messageInfo.type)
|
|
108
108
|
return commandTriggerCheckResult_1.CommandTriggerCheckResult.Trigger();
|
|
109
109
|
if (typeof trigger == 'string')
|
|
110
|
-
return ctx.
|
|
110
|
+
return ctx.messageInfo.text.toLowerCase() == trigger.toLowerCase()
|
|
111
111
|
? commandTriggerCheckResult_1.CommandTriggerCheckResult.Trigger()
|
|
112
112
|
: commandTriggerCheckResult_1.CommandTriggerCheckResult.DoNotTrigger('TriggerNotSatisfied');
|
|
113
113
|
const matchResults = [];
|
|
114
114
|
trigger.lastIndex = 0;
|
|
115
|
-
const execResult = trigger.exec(ctx.
|
|
115
|
+
const execResult = trigger.exec(ctx.messageInfo.text);
|
|
116
116
|
if (execResult != null) {
|
|
117
117
|
let regexMatchLimit = 100;
|
|
118
118
|
matchResults.push(execResult);
|
|
119
119
|
if (trigger.global) {
|
|
120
120
|
while (regexMatchLimit > 0) {
|
|
121
|
-
const nextResult = trigger.exec(ctx.
|
|
121
|
+
const nextResult = trigger.exec(ctx.messageInfo.text);
|
|
122
122
|
if (nextResult == null)
|
|
123
123
|
break;
|
|
124
124
|
matchResults.push(nextResult);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActionKey, IAction } from '../../types/action';
|
|
2
|
-
import {
|
|
2
|
+
import { InlineQueryContextInternal } from '../context/inlineQueryContext';
|
|
3
3
|
import { InlineQueryHandler } from '../../types/handlers';
|
|
4
4
|
export declare class InlineQueryAction implements IAction {
|
|
5
5
|
readonly key: ActionKey;
|
|
@@ -8,6 +8,6 @@ export declare class InlineQueryAction implements IAction {
|
|
|
8
8
|
readonly name: string;
|
|
9
9
|
readonly pattern: RegExp;
|
|
10
10
|
constructor(handler: InlineQueryHandler, name: string, active: boolean, pattern: RegExp);
|
|
11
|
-
exec(ctx:
|
|
11
|
+
exec(ctx: InlineQueryContextInternal): Promise<import("../../types/response").BotResponse[]>;
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=inlineQueryAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,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,0BAA0B;CAuC7C"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { IActionState } from '../../types/actionState';
|
|
2
2
|
import { CommandTrigger } from '../../types/commandTrigger';
|
|
3
3
|
import { ActionKey, IAction, IActionWithState } from '../../types/action';
|
|
4
|
-
import {
|
|
4
|
+
import { ReplyContextInternal } from '../context/replyContext';
|
|
5
5
|
export declare class ReplyCaptureAction<TParentActionState extends IActionState> implements IAction {
|
|
6
6
|
readonly parentMessageId: number;
|
|
7
7
|
readonly key: ActionKey;
|
|
8
|
-
readonly handler: (replyContext:
|
|
8
|
+
readonly handler: (replyContext: ReplyContextInternal<TParentActionState>) => Promise<void>;
|
|
9
9
|
readonly triggers: CommandTrigger[];
|
|
10
10
|
readonly abortController: AbortController;
|
|
11
|
-
constructor(parentMessageId: number, parentAction: IActionWithState<TParentActionState>, handler: (replyContext:
|
|
12
|
-
exec(ctx:
|
|
11
|
+
constructor(parentMessageId: number, parentAction: IActionWithState<TParentActionState>, handler: (replyContext: ReplyContextInternal<TParentActionState>) => Promise<void>, triggers: CommandTrigger[], abortController: AbortController);
|
|
12
|
+
exec(ctx: ReplyContextInternal<TParentActionState>): Promise<import("../../types/response").BotResponse[]>;
|
|
13
13
|
private checkIfShouldBeExecuted;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=replyCaptureAction.d.ts.map
|
|
@@ -1 +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,
|
|
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,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,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,oBAAoB,CAAC,kBAAkB,CAAC,KACrD,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;gBAGtC,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,EAClD,OAAO,EAAE,CACL,YAAY,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,KACrD,OAAO,CAAC,IAAI,CAAC,EAClB,QAAQ,EAAE,cAAc,EAAE,EAC1B,eAAe,EAAE,eAAe;IAY9B,IAAI,CAAC,GAAG,EAAE,oBAAoB,CAAC,kBAAkB,CAAC;IAyBxD,OAAO,CAAC,uBAAuB;CA+ClC"}
|
|
@@ -34,22 +34,22 @@ class ReplyCaptureAction {
|
|
|
34
34
|
checkIfShouldBeExecuted(ctx, trigger) {
|
|
35
35
|
if (ctx.replyMessageId != this.parentMessageId)
|
|
36
36
|
return commandTriggerCheckResult_1.CommandTriggerCheckResult.DoNotTrigger('TriggerNotSatisfied');
|
|
37
|
-
if (trigger == ctx.
|
|
37
|
+
if (trigger == ctx.messageInfo.type)
|
|
38
38
|
return commandTriggerCheckResult_1.CommandTriggerCheckResult.Trigger();
|
|
39
39
|
if (typeof trigger == 'string')
|
|
40
|
-
if (ctx.
|
|
40
|
+
if (ctx.messageInfo.text.toLowerCase() == trigger.toLowerCase())
|
|
41
41
|
return commandTriggerCheckResult_1.CommandTriggerCheckResult.Trigger();
|
|
42
42
|
else
|
|
43
43
|
return commandTriggerCheckResult_1.CommandTriggerCheckResult.DoNotTrigger('TriggerNotSatisfied');
|
|
44
44
|
const matchResults = [];
|
|
45
45
|
trigger.lastIndex = 0;
|
|
46
|
-
const execResult = trigger.exec(ctx.
|
|
46
|
+
const execResult = trigger.exec(ctx.messageInfo.text);
|
|
47
47
|
if (execResult != null) {
|
|
48
48
|
let regexMatchLimit = 100;
|
|
49
49
|
matchResults.push(execResult);
|
|
50
50
|
if (trigger.global) {
|
|
51
51
|
while (regexMatchLimit > 0) {
|
|
52
|
-
const nextResult = trigger.exec(ctx.
|
|
52
|
+
const nextResult = trigger.exec(ctx.messageInfo.text);
|
|
53
53
|
if (nextResult == null)
|
|
54
54
|
break;
|
|
55
55
|
matchResults.push(nextResult);
|
|
@@ -4,7 +4,7 @@ import { HoursOfDay } from '../../types/timeValues';
|
|
|
4
4
|
import { IActionState } from '../../types/actionState';
|
|
5
5
|
import { IActionWithState, ActionKey } from '../../types/action';
|
|
6
6
|
import { CachedStateFactory } from '../cachedStateFactory';
|
|
7
|
-
import {
|
|
7
|
+
import { ChatContextInternal } from '../context/chatContext';
|
|
8
8
|
export declare class ScheduledAction<TActionState extends IActionState> implements IActionWithState<TActionState> {
|
|
9
9
|
static readonly locks: Map<string, Semaphore>;
|
|
10
10
|
readonly name: string;
|
|
@@ -17,7 +17,7 @@ export declare class ScheduledAction<TActionState extends IActionState> implemen
|
|
|
17
17
|
readonly cachedStateFactories: Map<string, CachedStateFactory>;
|
|
18
18
|
readonly handler: ScheduledHandler<TActionState>;
|
|
19
19
|
constructor(name: string, handler: ScheduledHandler<TActionState>, timeinHours: HoursOfDay, active: boolean, whitelist: number[], cachedStateFactories: Map<string, CachedStateFactory>, stateConstructor: () => TActionState);
|
|
20
|
-
exec(ctx:
|
|
20
|
+
exec(ctx: ChatContextInternal<TActionState>): Promise<import("../../types/response").BotResponse[]>;
|
|
21
21
|
private getCachedValue;
|
|
22
22
|
private checkIfShouldBeExecuted;
|
|
23
23
|
}
|
|
@@ -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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AE,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,mBAAmB,CAAC,YAAY,CAAC;YAuCnC,cAAc;IA4C5B,OAAO,CAAC,uBAAuB;CAalC"}
|
|
@@ -6,7 +6,8 @@ import { BotResponse } from '../../types/response';
|
|
|
6
6
|
import { IScheduler } from '../../types/scheduler';
|
|
7
7
|
import { IStorageClient } from '../../types/storage';
|
|
8
8
|
import { TraceId } from '../../types/trace';
|
|
9
|
-
export
|
|
9
|
+
export type BaseContextPropertiesToOmit = 'action' | 'isInitialized' | 'storage' | 'scheduler' | 'logger' | 'responses' | 'traceId' | 'botName';
|
|
10
|
+
export declare abstract class BaseContextInternal<TAction extends IAction> {
|
|
10
11
|
isInitialized: boolean;
|
|
11
12
|
private _responses;
|
|
12
13
|
action: TAction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseContext.d.ts","sourceRoot":"","sources":["../../../entities/context/baseContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;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G;IACG,WAAW,CAAC,mBAAmB,SAAS,YAAY,EACtD,MAAM,EAAE,gBAAgB,CAAC,mBAAmB,CAAC;CAWpD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
class
|
|
3
|
+
exports.BaseContextInternal = void 0;
|
|
4
|
+
class BaseContextInternal {
|
|
5
5
|
isInitialized = false;
|
|
6
6
|
_responses = [];
|
|
7
7
|
action;
|
|
@@ -41,4 +41,4 @@ class BaseContext {
|
|
|
41
41
|
return Object.freeze(stateForChat);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
exports.
|
|
44
|
+
exports.BaseContextInternal = BaseContextInternal;
|
|
@@ -4,12 +4,13 @@ import { IActionState } from '../../types/actionState';
|
|
|
4
4
|
import { IReplyResponse } from '../../types/response';
|
|
5
5
|
import { Milliseconds } from '../../types/timeValues';
|
|
6
6
|
import { ICaptureController } from '../../types/capture';
|
|
7
|
-
import {
|
|
7
|
+
import { BaseContextInternal, BaseContextPropertiesToOmit } from './baseContext';
|
|
8
8
|
import { ScheduledAction } from '../actions/scheduledAction';
|
|
9
|
+
export type ChatContext<TActionState extends IActionState, TAction extends IActionWithState<TActionState> = ScheduledAction<TActionState>> = Omit<ChatContextInternal<TActionState, TAction>, BaseContextPropertiesToOmit>;
|
|
9
10
|
/**
|
|
10
11
|
* Context of action executed in chat.
|
|
11
12
|
*/
|
|
12
|
-
export declare class
|
|
13
|
+
export declare class ChatContextInternal<TActionState extends IActionState, TAction extends IActionWithState<TActionState> = ScheduledAction<TActionState>> extends BaseContextInternal<TAction> {
|
|
13
14
|
protected createCaptureController(response: IReplyResponse): ICaptureController;
|
|
14
15
|
/**
|
|
15
16
|
* Collection of actions that send something to chat as a standalone message.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatContext.d.ts","sourceRoot":"","sources":["../../../entities/context/chatContext.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,qBAAqB,EACrB,yBAAyB,EAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,
|
|
1
|
+
{"version":3,"file":"chatContext.d.ts","sourceRoot":"","sources":["../../../entities/context/chatContext.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,qBAAqB,EACrB,yBAAyB,EAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EACH,mBAAmB,EACnB,2BAA2B,EAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,MAAM,WAAW,CACnB,YAAY,SAAS,YAAY,EACjC,OAAO,SAAS,gBAAgB,CAAC,YAAY,CAAC,GAAG,eAAe,CAAC,YAAY,CAAC,IAC9E,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,GAAG,eAAe,CAAC,YAAY,CAAC,CAChF,SAAQ,mBAAmB,CAAC,OAAO,CAAC;IAClC,SAAS,CAAC,uBAAuB,CAC7B,QAAQ,EAAE,cAAc,GACzB,kBAAkB;IAmBrB;;OAEG;IACH,IAAI;QACA;;;;;WAKG;qBACU,MAAM,YAAY,yBAAyB;QAexD;;;;;WAKG;sBACW,MAAM,YAAY,qBAAqB;QAerD;;;;;WAKG;sBACW,MAAM,YAAY,qBAAqB;MAcvD;IAEF;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM;IAW9B;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,YAAY;CAK3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ChatContextInternal = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const imageMessage_1 = require("../../dtos/responses/imageMessage");
|
|
6
6
|
const textMessage_1 = require("../../dtos/responses/textMessage");
|
|
@@ -11,7 +11,7 @@ const baseContext_1 = require("./baseContext");
|
|
|
11
11
|
/**
|
|
12
12
|
* Context of action executed in chat.
|
|
13
13
|
*/
|
|
14
|
-
class
|
|
14
|
+
class ChatContextInternal extends baseContext_1.BaseContextInternal {
|
|
15
15
|
createCaptureController(response) {
|
|
16
16
|
return {
|
|
17
17
|
captureReplies: (trigger, handler, abortController) => {
|
|
@@ -78,4 +78,4 @@ class ChatContext extends baseContext_1.BaseContext {
|
|
|
78
78
|
this.responses.push(new delay_1.DelayResponse(delay, this.chatInfo, this.traceId, this.action));
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
exports.
|
|
81
|
+
exports.ChatContextInternal = ChatContextInternal;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { InlineQueryResult } from 'telegraf/types';
|
|
2
2
|
import { BotResponse } from '../../types/response';
|
|
3
3
|
import { InlineQueryAction } from '../actions/inlineQueryAction';
|
|
4
|
-
import {
|
|
5
|
-
export
|
|
4
|
+
import { BaseContextInternal, BaseContextPropertiesToOmit } from './baseContext';
|
|
5
|
+
export type InlineQueryContext = Omit<InlineQueryContextInternal, BaseContextPropertiesToOmit | 'queryResults' | 'queryId'>;
|
|
6
|
+
export declare class InlineQueryContextInternal extends BaseContextInternal<InlineQueryAction> {
|
|
6
7
|
queryResults: InlineQueryResult[];
|
|
7
8
|
/**
|
|
8
9
|
* Abort signal to be utilized in query handler.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineQueryContext.d.ts","sourceRoot":"","sources":["../../../entities/context/inlineQueryContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,
|
|
1
|
+
{"version":3,"file":"inlineQueryContext.d.ts","sourceRoot":"","sources":["../../../entities/context/inlineQueryContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EACH,mBAAmB,EACnB,2BAA2B,EAC9B,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACjC,0BAA0B,EAC1B,2BAA2B,GAAG,cAAc,GAAG,SAAS,CAC3D,CAAC;AAEF,qBAAa,0BAA2B,SAAQ,mBAAmB,CAAC,iBAAiB,CAAC;IAClF,YAAY,EAAE,iBAAiB,EAAE,CAAM;IACvC;;;OAGG;IACH,WAAW,EAAG,WAAW,CAAC;IAE1B,uDAAuD;IACvD,IAAI,SAAS,IAAI,WAAW,EAAE,CAS7B;IACD,wBAAwB;IACxB,SAAS,EAAG,MAAM,CAAC;IACnB,wBAAwB;IACxB,OAAO,EAAG,MAAM,CAAC;IACjB,4HAA4H;IAC5H,YAAY,EAAE,gBAAgB,EAAE,CAAM;IAEtC;;;OAGG;IACH,qBAAqB,CAAC,WAAW,EAAE,iBAAiB;CAGvD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.InlineQueryContextInternal = void 0;
|
|
4
4
|
const inlineQueryResponse_1 = require("../../dtos/responses/inlineQueryResponse");
|
|
5
5
|
const baseContext_1 = require("./baseContext");
|
|
6
|
-
class
|
|
6
|
+
class InlineQueryContextInternal extends baseContext_1.BaseContextInternal {
|
|
7
7
|
queryResults = [];
|
|
8
8
|
/**
|
|
9
9
|
* Abort signal to be utilized in query handler.
|
|
@@ -30,4 +30,4 @@ class InlineQueryContext extends baseContext_1.BaseContext {
|
|
|
30
30
|
this.queryResults.push(queryResult);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
exports.
|
|
33
|
+
exports.InlineQueryContextInternal = InlineQueryContextInternal;
|