chz-telegram-bot 0.3.3 → 0.3.5
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/incomingMessage.d.ts.map +1 -1
- package/dist/dtos/incomingMessage.js +2 -0
- package/dist/helpers/objectFromEntries.d.ts +2 -0
- package/dist/helpers/objectFromEntries.d.ts.map +1 -0
- package/dist/helpers/objectFromEntries.js +7 -0
- package/dist/services/actionProcessors/commandActionProcessor.d.ts +0 -1
- package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +1 -1
- package/dist/services/actionProcessors/commandActionProcessor.js +21 -13
- package/dist/types/messageTypes.d.ts +2 -1
- package/dist/types/messageTypes.d.ts.map +1 -1
- package/dist/types/messageTypes.js +2 -1
- package/dtos/incomingMessage.ts +1 -0
- package/helpers/objectFromEntries.ts +7 -0
- package/package.json +1 -1
- package/services/actionProcessors/commandActionProcessor.ts +38 -29
- package/types/messageTypes.ts +2 -1
|
@@ -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,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;
|
|
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;gBAoBb,UAAU,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM;CAsBlE"}
|
|
@@ -11,6 +11,8 @@ class IncomingMessage {
|
|
|
11
11
|
return messageTypes_1.MessageType.Forward;
|
|
12
12
|
if ('text' in message)
|
|
13
13
|
return messageTypes_1.MessageType.Text;
|
|
14
|
+
if ('video' in message)
|
|
15
|
+
return messageTypes_1.MessageType.Video;
|
|
14
16
|
if ('photo' in message)
|
|
15
17
|
return messageTypes_1.MessageType.Photo;
|
|
16
18
|
if ('sticker' in message)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectFromEntries.d.ts","sourceRoot":"","sources":["../../helpers/objectFromEntries.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,GAClC,KAAK,CAAC,CAAC,SAAS,aAAa,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,EAE9D,SAAS,CAAC,KACX,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAElC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.typeSafeObjectFromEntries = void 0;
|
|
4
|
+
const typeSafeObjectFromEntries = (entries) => {
|
|
5
|
+
return Object.fromEntries(entries);
|
|
6
|
+
};
|
|
7
|
+
exports.typeSafeObjectFromEntries = typeSafeObjectFromEntries;
|
|
@@ -17,7 +17,6 @@ export declare class CommandActionProcessor {
|
|
|
17
17
|
private api;
|
|
18
18
|
private telegraf;
|
|
19
19
|
private commands;
|
|
20
|
-
private permanentTriggersToBeProcessed;
|
|
21
20
|
constructor(botName: string, storage: IStorageClient, scheduler: IScheduler, logger: ILogger);
|
|
22
21
|
initialize(api: TelegramApiService, telegraf: Telegraf, commands: CommandAction<IActionState>[], verboseLoggingForIncomingMessage: boolean): void;
|
|
23
22
|
captureRegistrationCallback(capture: IReplyCapture, parentMessageId: number, chatInfo: ChatInfo, traceId: TraceId): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandActionProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/commandActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAKrE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"commandActionProcessor.d.ts","sourceRoot":"","sources":["../../../services/actionProcessors/commandActionProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAKrE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAO/C,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IAEjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqC;IAEnE,OAAO,CAAC,GAAG,CAAsB;IACjC,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,QAAQ,CAKd;gBAGE,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,OAAO;IAUnB,UAAU,CACN,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,EAAE,EACvC,gCAAgC,EAAE,OAAO;IA0D7C,2BAA2B,CACvB,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO;YA+BN,cAAc;IAsC5B,OAAO,CAAC,6BAA6B;IA6BrC,OAAO,CAAC,wBAAwB;CA8BnC"}
|
|
@@ -6,8 +6,13 @@ const replyCaptureAction_1 = require("../../entities/actions/replyCaptureAction"
|
|
|
6
6
|
const messageContext_1 = require("../../entities/context/messageContext");
|
|
7
7
|
const replyContext_1 = require("../../entities/context/replyContext");
|
|
8
8
|
const messageTypes_1 = require("../../types/messageTypes");
|
|
9
|
+
const objectFromEntries_1 = require("../../helpers/objectFromEntries");
|
|
9
10
|
class CommandActionProcessor {
|
|
10
11
|
constructor(botName, storage, scheduler, logger) {
|
|
12
|
+
this.commands = (0, objectFromEntries_1.typeSafeObjectFromEntries)(Object.values(messageTypes_1.MessageType).map((x) => [
|
|
13
|
+
x,
|
|
14
|
+
[]
|
|
15
|
+
]));
|
|
11
16
|
this.storage = storage;
|
|
12
17
|
this.scheduler = scheduler;
|
|
13
18
|
this.logger = logger;
|
|
@@ -17,15 +22,20 @@ class CommandActionProcessor {
|
|
|
17
22
|
initialize(api, telegraf, commands, verboseLoggingForIncomingMessage) {
|
|
18
23
|
this.api = api;
|
|
19
24
|
this.telegraf = telegraf;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
for (const msgType of Object.values(messageTypes_1.MessageType)) {
|
|
26
|
+
if (msgType == messageTypes_1.MessageType.Text) {
|
|
27
|
+
this.commands[msgType] = commands.filter((cmd) => cmd.triggers.find((x) => typeof x != 'string') !=
|
|
28
|
+
undefined ||
|
|
29
|
+
cmd.triggers.find((x) => typeof x == 'string' &&
|
|
30
|
+
!x.startsWith(messageTypes_1.INTERNAL_MESSAGE_TYPE_PREFIX)) ||
|
|
31
|
+
cmd.triggers.includes(messageTypes_1.MessageType.Text) ||
|
|
32
|
+
cmd.triggers.includes(messageTypes_1.MessageType.Any));
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
this.commands[msgType] = commands.filter((cmd) => cmd.triggers.includes(msgType) ||
|
|
36
|
+
cmd.triggers.includes(messageTypes_1.MessageType.Any));
|
|
37
|
+
}
|
|
38
|
+
if (commands.length > 0) {
|
|
29
39
|
this.telegraf.on('message', async (ctx) => {
|
|
30
40
|
const msg = new incomingMessage_1.IncomingMessage(ctx.update.message, this.botName);
|
|
31
41
|
const logger = this.logger.createScope(this.botName, msg.traceId, msg.chatInfo.name);
|
|
@@ -35,9 +45,7 @@ class CommandActionProcessor {
|
|
|
35
45
|
else {
|
|
36
46
|
logger.logWithTraceId(`${msg.from?.first_name ?? 'Unknown'} (${msg.from?.id ?? 'Unknown'}): ${msg.text || `<non-text message: ${msg.type}>`}`);
|
|
37
47
|
}
|
|
38
|
-
|
|
39
|
-
this.replyCaptures.find((x) => x.parentMessageId == msg.replyToMessageId))
|
|
40
|
-
await this.processMessage(msg);
|
|
48
|
+
await this.processMessage(msg);
|
|
41
49
|
});
|
|
42
50
|
}
|
|
43
51
|
}
|
|
@@ -54,7 +62,7 @@ class CommandActionProcessor {
|
|
|
54
62
|
}
|
|
55
63
|
async processMessage(msg) {
|
|
56
64
|
const ctx = new messageContext_1.MessageContext(this.storage, this.scheduler);
|
|
57
|
-
for (const commandAction of this.commands) {
|
|
65
|
+
for (const commandAction of this.commands[msg.type]) {
|
|
58
66
|
this.initializeMessageContext(ctx, commandAction, msg);
|
|
59
67
|
try {
|
|
60
68
|
const responses = await commandAction.exec(ctx);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Message, Update } from 'telegraf/types';
|
|
2
2
|
export declare const INTERNAL_MESSAGE_TYPE_PREFIX = "__msg:";
|
|
3
3
|
export declare const MessageType: {
|
|
4
|
-
readonly Any: "__msg:
|
|
4
|
+
readonly Any: "__msg:Any";
|
|
5
5
|
readonly Text: "__msg:Text";
|
|
6
6
|
readonly Sticker: "__msg:Sticker";
|
|
7
7
|
readonly Animation: "__msg:Animation";
|
|
@@ -14,6 +14,7 @@ export declare const MessageType: {
|
|
|
14
14
|
readonly Location: "__msg:Location";
|
|
15
15
|
readonly Photo: "__msg:Photo";
|
|
16
16
|
readonly Forward: "__msg:Forward";
|
|
17
|
+
readonly Video: "__msg:Video";
|
|
17
18
|
readonly Unknown: "__msg:Unknown";
|
|
18
19
|
};
|
|
19
20
|
export type MessageTypeValue = (typeof MessageType)[keyof typeof MessageType];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageTypes.d.ts","sourceRoot":"","sources":["../../types/messageTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEjD,eAAO,MAAM,4BAA4B,WAAW,CAAC;AAErD,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"messageTypes.d.ts","sourceRoot":"","sources":["../../types/messageTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEjD,eAAO,MAAM,4BAA4B,WAAW,CAAC;AAErD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAE9E,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MessageType = exports.INTERNAL_MESSAGE_TYPE_PREFIX = void 0;
|
|
4
4
|
exports.INTERNAL_MESSAGE_TYPE_PREFIX = `__msg:`;
|
|
5
5
|
exports.MessageType = {
|
|
6
|
-
Any: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}
|
|
6
|
+
Any: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Any`,
|
|
7
7
|
Text: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Text`,
|
|
8
8
|
Sticker: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Sticker`,
|
|
9
9
|
Animation: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Animation`,
|
|
@@ -16,5 +16,6 @@ exports.MessageType = {
|
|
|
16
16
|
Location: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Location`,
|
|
17
17
|
Photo: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Photo`,
|
|
18
18
|
Forward: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Forward`,
|
|
19
|
+
Video: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Video`,
|
|
19
20
|
Unknown: `${exports.INTERNAL_MESSAGE_TYPE_PREFIX}Unknown`
|
|
20
21
|
};
|
package/dtos/incomingMessage.ts
CHANGED
|
@@ -25,6 +25,7 @@ export class IncomingMessage {
|
|
|
25
25
|
) {
|
|
26
26
|
if ('forward_origin' in message) return MessageType.Forward;
|
|
27
27
|
if ('text' in message) return MessageType.Text;
|
|
28
|
+
if ('video' in message) return MessageType.Video;
|
|
28
29
|
if ('photo' in message) return MessageType.Photo;
|
|
29
30
|
if ('sticker' in message) return MessageType.Sticker;
|
|
30
31
|
if ('animation' in message) return MessageType.Animation;
|
package/package.json
CHANGED
|
@@ -7,16 +7,17 @@ import { ReplyContext } from '../../entities/context/replyContext';
|
|
|
7
7
|
import { IActionWithState } from '../../types/action';
|
|
8
8
|
import { IActionState } from '../../types/actionState';
|
|
9
9
|
import { ILogger } from '../../types/logger';
|
|
10
|
-
import {
|
|
11
|
-
INTERNAL_MESSAGE_TYPE_PREFIX,
|
|
12
|
-
MessageType
|
|
13
|
-
} from '../../types/messageTypes';
|
|
14
10
|
import { IScheduler } from '../../types/scheduler';
|
|
15
11
|
import { IStorageClient } from '../../types/storage';
|
|
16
12
|
import { TelegramApiService } from '../telegramApi';
|
|
17
13
|
import { IReplyCapture } from '../../types/capture';
|
|
18
14
|
import { TraceId } from '../../types/trace';
|
|
19
15
|
import { ChatInfo } from '../../dtos/chatInfo';
|
|
16
|
+
import {
|
|
17
|
+
INTERNAL_MESSAGE_TYPE_PREFIX,
|
|
18
|
+
MessageType
|
|
19
|
+
} from '../../types/messageTypes';
|
|
20
|
+
import { typeSafeObjectFromEntries } from '../../helpers/objectFromEntries';
|
|
20
21
|
|
|
21
22
|
export class CommandActionProcessor {
|
|
22
23
|
private readonly storage: IStorageClient;
|
|
@@ -28,9 +29,12 @@ export class CommandActionProcessor {
|
|
|
28
29
|
|
|
29
30
|
private api!: TelegramApiService;
|
|
30
31
|
private telegraf!: Telegraf;
|
|
31
|
-
private commands
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
private commands = typeSafeObjectFromEntries(
|
|
33
|
+
Object.values(MessageType).map((x) => [
|
|
34
|
+
x,
|
|
35
|
+
[] as CommandAction<IActionState>[]
|
|
36
|
+
])
|
|
37
|
+
);
|
|
34
38
|
|
|
35
39
|
constructor(
|
|
36
40
|
botName: string,
|
|
@@ -54,21 +58,33 @@ export class CommandActionProcessor {
|
|
|
54
58
|
) {
|
|
55
59
|
this.api = api;
|
|
56
60
|
this.telegraf = telegraf;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
|
|
62
|
+
for (const msgType of Object.values(MessageType)) {
|
|
63
|
+
if (msgType == MessageType.Text) {
|
|
64
|
+
this.commands[msgType] = commands.filter(
|
|
65
|
+
(cmd) =>
|
|
66
|
+
cmd.triggers.find((x) => typeof x != 'string') !=
|
|
67
|
+
undefined ||
|
|
68
|
+
cmd.triggers.find(
|
|
69
|
+
(x) =>
|
|
70
|
+
typeof x == 'string' &&
|
|
71
|
+
!x.startsWith(INTERNAL_MESSAGE_TYPE_PREFIX)
|
|
72
|
+
) ||
|
|
73
|
+
cmd.triggers.includes(MessageType.Text) ||
|
|
74
|
+
cmd.triggers.includes(MessageType.Any)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this.commands[msgType] = commands.filter(
|
|
81
|
+
(cmd) =>
|
|
82
|
+
cmd.triggers.includes(msgType) ||
|
|
83
|
+
cmd.triggers.includes(MessageType.Any)
|
|
70
84
|
);
|
|
85
|
+
}
|
|
71
86
|
|
|
87
|
+
if (commands.length > 0) {
|
|
72
88
|
this.telegraf.on('message', async (ctx) => {
|
|
73
89
|
const msg = new IncomingMessage(
|
|
74
90
|
ctx.update.message,
|
|
@@ -91,13 +107,7 @@ export class CommandActionProcessor {
|
|
|
91
107
|
);
|
|
92
108
|
}
|
|
93
109
|
|
|
94
|
-
|
|
95
|
-
this.permanentTriggersToBeProcessed.has(msg.type) ||
|
|
96
|
-
this.replyCaptures.find(
|
|
97
|
-
(x) => x.parentMessageId == msg.replyToMessageId
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
await this.processMessage(msg);
|
|
110
|
+
await this.processMessage(msg);
|
|
101
111
|
});
|
|
102
112
|
}
|
|
103
113
|
}
|
|
@@ -137,14 +147,13 @@ export class CommandActionProcessor {
|
|
|
137
147
|
);
|
|
138
148
|
});
|
|
139
149
|
}
|
|
140
|
-
|
|
141
150
|
private async processMessage(msg: IncomingMessage) {
|
|
142
151
|
const ctx = new MessageContext<IActionState>(
|
|
143
152
|
this.storage,
|
|
144
153
|
this.scheduler
|
|
145
154
|
);
|
|
146
155
|
|
|
147
|
-
for (const commandAction of this.commands) {
|
|
156
|
+
for (const commandAction of this.commands[msg.type]) {
|
|
148
157
|
this.initializeMessageContext(ctx, commandAction, msg);
|
|
149
158
|
|
|
150
159
|
try {
|
package/types/messageTypes.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Message, Update } from 'telegraf/types';
|
|
|
3
3
|
export const INTERNAL_MESSAGE_TYPE_PREFIX = `__msg:`;
|
|
4
4
|
|
|
5
5
|
export const MessageType = {
|
|
6
|
-
Any: `${INTERNAL_MESSAGE_TYPE_PREFIX}
|
|
6
|
+
Any: `${INTERNAL_MESSAGE_TYPE_PREFIX}Any`,
|
|
7
7
|
Text: `${INTERNAL_MESSAGE_TYPE_PREFIX}Text`,
|
|
8
8
|
Sticker: `${INTERNAL_MESSAGE_TYPE_PREFIX}Sticker`,
|
|
9
9
|
Animation: `${INTERNAL_MESSAGE_TYPE_PREFIX}Animation`,
|
|
@@ -16,6 +16,7 @@ export const MessageType = {
|
|
|
16
16
|
Location: `${INTERNAL_MESSAGE_TYPE_PREFIX}Location`,
|
|
17
17
|
Photo: `${INTERNAL_MESSAGE_TYPE_PREFIX}Photo`,
|
|
18
18
|
Forward: `${INTERNAL_MESSAGE_TYPE_PREFIX}Forward`,
|
|
19
|
+
Video: `${INTERNAL_MESSAGE_TYPE_PREFIX}Video`,
|
|
19
20
|
Unknown: `${INTERNAL_MESSAGE_TYPE_PREFIX}Unknown`
|
|
20
21
|
} as const;
|
|
21
22
|
|