chz-telegram-bot 0.0.13 → 0.0.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/entities/context/chatContext.d.ts +1 -1
- package/dist/entities/context/chatContext.d.ts.map +1 -1
- package/dist/entities/context/chatContext.js +2 -2
- package/dist/entities/context/messageContext.d.ts +1 -1
- package/dist/entities/context/messageContext.d.ts.map +1 -1
- package/dist/entities/context/messageContext.js +2 -2
- package/dist/entities/responses/imageMessage.d.ts +1 -0
- package/dist/entities/responses/imageMessage.d.ts.map +1 -1
- package/dist/entities/responses/imageMessage.js +1 -0
- package/dist/entities/responses/textMessage.d.ts +2 -1
- package/dist/entities/responses/textMessage.d.ts.map +1 -1
- package/dist/entities/responses/textMessage.js +2 -1
- package/dist/entities/responses/videoMessage.d.ts +1 -0
- package/dist/entities/responses/videoMessage.d.ts.map +1 -1
- package/dist/entities/responses/videoMessage.js +1 -0
- package/dist/index.d.ts +7 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -15
- package/dist/services/telegramApi.d.ts +1 -1
- package/dist/services/telegramApi.js +1 -1
- package/dist/types/replyMessage.d.ts +1 -0
- package/dist/types/replyMessage.d.ts.map +1 -1
- package/entities/context/chatContext.ts +8 -2
- package/entities/context/messageContext.ts +8 -3
- package/entities/responses/imageMessage.ts +1 -0
- package/entities/responses/textMessage.ts +4 -1
- package/entities/responses/videoMessage.ts +1 -0
- package/eslint.config.js +6 -6
- package/index.ts +7 -30
- package/package.json +1 -1
- package/services/telegramApi.ts +1 -1
- package/types/replyMessage.ts +1 -0
- package/bun.lockb +0 -0
|
@@ -8,7 +8,7 @@ export default class ChatContext {
|
|
|
8
8
|
traceId: number | string;
|
|
9
9
|
storage: IStorageClient;
|
|
10
10
|
constructor(botName: string, interactions: IBotApiInteractions, chatId: number, chatName: string, traceId: number | string, storage: IStorageClient);
|
|
11
|
-
sendTextToChat(text: string): void;
|
|
11
|
+
sendTextToChat(text: string, disableWebPreview?: boolean): void;
|
|
12
12
|
sendImageToChat(name: string): void;
|
|
13
13
|
sendVideoToChat(name: string): void;
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatContext.d.ts","sourceRoot":"","sources":["../../../entities/context/chatContext.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,WAAW;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,mBAAmB,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,EAAE,cAAc,CAAC;gBAGpB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,OAAO,EAAE,cAAc;IAU3B,cAAc,CAAC,IAAI,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"chatContext.d.ts","sourceRoot":"","sources":["../../../entities/context/chatContext.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,WAAW;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,mBAAmB,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,EAAE,cAAc,CAAC;gBAGpB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,OAAO,EAAE,cAAc;IAU3B,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO;IAYxD,eAAe,CAAC,IAAI,EAAE,MAAM;IAY5B,eAAe,CAAC,IAAI,EAAE,MAAM;CAW/B"}
|
|
@@ -16,8 +16,8 @@ class ChatContext {
|
|
|
16
16
|
this.traceId = traceId;
|
|
17
17
|
this.storage = storage;
|
|
18
18
|
}
|
|
19
|
-
sendTextToChat(text) {
|
|
20
|
-
this.interactions.respond(new textMessage_1.default(text, this.chatId, undefined, this.traceId));
|
|
19
|
+
sendTextToChat(text, disableWebPreview) {
|
|
20
|
+
this.interactions.respond(new textMessage_1.default(text, this.chatId, undefined, this.traceId, disableWebPreview ?? false));
|
|
21
21
|
}
|
|
22
22
|
sendImageToChat(name) {
|
|
23
23
|
const filePath = `./content/${name}.png`;
|
|
@@ -14,7 +14,7 @@ export default class MessageContext<TActionState extends IActionState> extends C
|
|
|
14
14
|
constructor(botName: string, interactions: IBotApiInteractions, chatId: number, chatName: string, messageId: number, messageText: string, fromUserId: number | undefined, traceId: number | string, fromUserName: string, storage: IStorageClient);
|
|
15
15
|
loadStateOf<TAnotherActionState extends IActionState>(commandName: string): Promise<TAnotherActionState>;
|
|
16
16
|
updateState(stateUpdateAction: (state: TActionState) => void): void;
|
|
17
|
-
replyWithText(text: string): void;
|
|
17
|
+
replyWithText(text: string, disableWebPreview?: boolean): void;
|
|
18
18
|
replyWithImage(name: string): void;
|
|
19
19
|
replyWithVideo(name: string): void;
|
|
20
20
|
react(emoji: TelegramEmoji): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageContext.d.ts","sourceRoot":"","sources":["../../../entities/context/messageContext.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"messageContext.d.ts","sourceRoot":"","sources":["../../../entities/context/messageContext.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,cAAc,CAC/B,YAAY,SAAS,YAAY,CACnC,SAAQ,WAAW;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,gBAAgB,EAAE,CAAM;IACtC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,aAAa,EAAE,OAAO,CAAQ;IAC9B,aAAa,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC,CAAM;IACzD,YAAY,EAAE,MAAM,CAAC;gBAGjB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,cAAc;IAUrB,WAAW,CAAC,mBAAmB,SAAS,YAAY,EACtD,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,CAAC;IAU/B,WAAW,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI;IAM5D,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO;IAYvD,cAAc,CAAC,IAAI,EAAE,MAAM;IAY3B,cAAc,CAAC,IAAI,EAAE,MAAM;IAY3B,KAAK,CAAC,KAAK,EAAE,aAAa;CAK7B"}
|
|
@@ -27,8 +27,8 @@ class MessageContext extends chatContext_1.default {
|
|
|
27
27
|
updateState(stateUpdateAction) {
|
|
28
28
|
this.updateActions.push(stateUpdateAction);
|
|
29
29
|
}
|
|
30
|
-
replyWithText(text) {
|
|
31
|
-
this.interactions.respond(new textMessage_1.default(text, this.chatId, this.messageId, this.traceId));
|
|
30
|
+
replyWithText(text, disableWebPreview) {
|
|
31
|
+
this.interactions.respond(new textMessage_1.default(text, this.chatId, this.messageId, this.traceId, disableWebPreview ?? false));
|
|
32
32
|
}
|
|
33
33
|
replyWithImage(name) {
|
|
34
34
|
const filePath = `./content/${name}.png`;
|
|
@@ -5,6 +5,7 @@ export default class ImageMessage implements IReplyMessage<InputFile> {
|
|
|
5
5
|
chatId: number;
|
|
6
6
|
replyId: number | undefined;
|
|
7
7
|
traceId: string | number;
|
|
8
|
+
disableWebPreview: boolean;
|
|
8
9
|
constructor(image: InputFile, chatId: number, replyId: number | undefined, traceId: number | string);
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=imageMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageMessage.d.ts","sourceRoot":"","sources":["../../../entities/responses/imageMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,aAAa,CAAC,SAAS,CAAC;IACjE,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"imageMessage.d.ts","sourceRoot":"","sources":["../../../entities/responses/imageMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,aAAa,CAAC,SAAS,CAAC;IACjE,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,iBAAiB,UAAS;gBAGtB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,MAAM;CAO/B"}
|
|
@@ -4,6 +4,7 @@ export default class TextMessage implements IReplyMessage<string> {
|
|
|
4
4
|
chatId: number;
|
|
5
5
|
replyId: number | undefined;
|
|
6
6
|
traceId: string | number;
|
|
7
|
-
|
|
7
|
+
disableWebPreview: boolean;
|
|
8
|
+
constructor(text: string, chatId: number, replyId: number | undefined, traceId: string | number, disableWebPreview: boolean);
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=textMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textMessage.d.ts","sourceRoot":"","sources":["../../../entities/responses/textMessage.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,aAAa,CAAC,MAAM,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"textMessage.d.ts","sourceRoot":"","sources":["../../../entities/responses/textMessage.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,aAAa,CAAC,MAAM,CAAC;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;gBAGvB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,iBAAiB,EAAE,OAAO;CAQjC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class TextMessage {
|
|
4
|
-
constructor(text, chatId, replyId, traceId) {
|
|
4
|
+
constructor(text, chatId, replyId, traceId, disableWebPreview) {
|
|
5
5
|
this.content = text;
|
|
6
6
|
this.chatId = chatId;
|
|
7
7
|
this.replyId = replyId;
|
|
8
8
|
this.traceId = traceId;
|
|
9
|
+
this.disableWebPreview = disableWebPreview;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
exports.default = TextMessage;
|
|
@@ -5,6 +5,7 @@ export default class VideoMessage implements IReplyMessage<InputFile> {
|
|
|
5
5
|
chatId: number;
|
|
6
6
|
replyId: number | undefined;
|
|
7
7
|
traceId: string | number;
|
|
8
|
+
disableWebPreview: boolean;
|
|
8
9
|
constructor(video: InputFile, chatId: number, replyId: number | undefined, traceId: number | string);
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=videoMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"videoMessage.d.ts","sourceRoot":"","sources":["../../../entities/responses/videoMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,aAAa,CAAC,SAAS,CAAC;IACjE,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"videoMessage.d.ts","sourceRoot":"","sources":["../../../entities/responses/videoMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,MAAM,CAAC,OAAO,OAAO,YAAa,YAAW,aAAa,CAAC,SAAS,CAAC;IACjE,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,iBAAiB,UAAS;gBAGtB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,MAAM;CAO/B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
export { startBot, stopBots } from './main';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { Hours, Milliseconds, Seconds } from './types/timeValues';
|
|
10
|
-
export declare const helpers: {
|
|
11
|
-
hoursToMilliseconds: typeof hoursToMilliseconds;
|
|
12
|
-
hoursToSeconds: typeof hoursToSeconds;
|
|
13
|
-
secondsToMilliseconds: typeof secondsToMilliseconds;
|
|
14
|
-
};
|
|
15
|
-
export { CommandActionBuilder, CommandActionBuilderWithState, ScheduledActionBuilder, IStorageClient, IActionState, ActionStateBase, Milliseconds, Seconds, Hours };
|
|
2
|
+
export { CommandActionBuilder } from './helpers/builders/commandActionBuilder';
|
|
3
|
+
export { CommandActionBuilderWithState } from './helpers/builders/commandActionBuilder';
|
|
4
|
+
export * from './helpers/builders/scheduledActionBuilder';
|
|
5
|
+
export { IStorageClient } from './types/storage';
|
|
6
|
+
export * from './types/actionState';
|
|
7
|
+
export * from './entities/states/actionStateBase';
|
|
8
|
+
export { Hours, Milliseconds, Seconds } from './types/timeValues';
|
|
16
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,cAAc,2CAA2C,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,cAAc,qBAAqB,CAAC;AACpC,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
17
|
+
exports.CommandActionBuilderWithState = exports.CommandActionBuilder = exports.stopBots = exports.startBot = void 0;
|
|
7
18
|
var main_1 = require("./main");
|
|
8
19
|
Object.defineProperty(exports, "startBot", { enumerable: true, get: function () { return main_1.startBot; } });
|
|
9
20
|
Object.defineProperty(exports, "stopBots", { enumerable: true, get: function () { return main_1.stopBots; } });
|
|
10
|
-
|
|
21
|
+
var commandActionBuilder_1 = require("./helpers/builders/commandActionBuilder");
|
|
11
22
|
Object.defineProperty(exports, "CommandActionBuilder", { enumerable: true, get: function () { return commandActionBuilder_1.CommandActionBuilder; } });
|
|
12
|
-
|
|
23
|
+
var commandActionBuilder_2 = require("./helpers/builders/commandActionBuilder");
|
|
13
24
|
Object.defineProperty(exports, "CommandActionBuilderWithState", { enumerable: true, get: function () { return commandActionBuilder_2.CommandActionBuilderWithState; } });
|
|
14
|
-
|
|
15
|
-
exports
|
|
16
|
-
|
|
17
|
-
const actionStateBase_1 = __importDefault(require("./entities/states/actionStateBase"));
|
|
18
|
-
exports.ActionStateBase = actionStateBase_1.default;
|
|
19
|
-
exports.helpers = {
|
|
20
|
-
hoursToMilliseconds: timeConvertions_1.hoursToMilliseconds,
|
|
21
|
-
hoursToSeconds: timeConvertions_1.hoursToSeconds,
|
|
22
|
-
secondsToMilliseconds: timeConvertions_1.secondsToMilliseconds
|
|
23
|
-
};
|
|
25
|
+
__exportStar(require("./helpers/builders/scheduledActionBuilder"), exports);
|
|
26
|
+
__exportStar(require("./types/actionState"), exports);
|
|
27
|
+
__exportStar(require("./entities/states/actionStateBase"), exports);
|
|
@@ -17,7 +17,7 @@ export default class TelegramApiService {
|
|
|
17
17
|
private enqueueResponse;
|
|
18
18
|
private enqueueReaction;
|
|
19
19
|
private getInteractions;
|
|
20
|
-
createContextForMessage(incomingMessage: IncomingMessage): MessageContext<import("
|
|
20
|
+
createContextForMessage(incomingMessage: IncomingMessage): MessageContext<import("../types/actionState").default>;
|
|
21
21
|
createContextForChat(chatId: number, scheduledName: string): ChatContext;
|
|
22
22
|
}
|
|
23
23
|
export interface IBotApiInteractions {
|
|
@@ -48,7 +48,7 @@ class TelegramApiService {
|
|
|
48
48
|
await this.telegraf.telegram.sendMessage(response.chatId, response.content, {
|
|
49
49
|
reply_to_message_id: response.replyId,
|
|
50
50
|
parse_mode: 'MarkdownV2',
|
|
51
|
-
disable_web_page_preview:
|
|
51
|
+
disable_web_page_preview: response.disableWebPreview
|
|
52
52
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
53
|
});
|
|
54
54
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replyMessage.d.ts","sourceRoot":"","sources":["../../types/replyMessage.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC,KAAK;IACxC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"replyMessage.d.ts","sourceRoot":"","sources":["../../types/replyMessage.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC,KAAK;IACxC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;CAC9B"}
|
|
@@ -29,9 +29,15 @@ export default class ChatContext {
|
|
|
29
29
|
this.storage = storage;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
sendTextToChat(text: string) {
|
|
32
|
+
sendTextToChat(text: string, disableWebPreview?: boolean) {
|
|
33
33
|
this.interactions.respond(
|
|
34
|
-
new TextMessage(
|
|
34
|
+
new TextMessage(
|
|
35
|
+
text,
|
|
36
|
+
this.chatId,
|
|
37
|
+
undefined,
|
|
38
|
+
this.traceId,
|
|
39
|
+
disableWebPreview ?? false
|
|
40
|
+
)
|
|
35
41
|
);
|
|
36
42
|
}
|
|
37
43
|
|
|
@@ -3,7 +3,6 @@ import ImageMessage from '../responses/imageMessage';
|
|
|
3
3
|
import TextMessage from '../responses/textMessage';
|
|
4
4
|
import VideoMessage from '../responses/videoMessage';
|
|
5
5
|
import ChatContext from './chatContext';
|
|
6
|
-
import storage from '../../services/jsonFileStorage';
|
|
7
6
|
import { resolve } from 'path';
|
|
8
7
|
import IActionState from '../../types/actionState';
|
|
9
8
|
import { IBotApiInteractions } from '../../services/telegramApi';
|
|
@@ -60,9 +59,15 @@ export default class MessageContext<
|
|
|
60
59
|
);
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
replyWithText(text: string) {
|
|
62
|
+
replyWithText(text: string, disableWebPreview?: boolean) {
|
|
64
63
|
this.interactions.respond(
|
|
65
|
-
new TextMessage(
|
|
64
|
+
new TextMessage(
|
|
65
|
+
text,
|
|
66
|
+
this.chatId,
|
|
67
|
+
this.messageId,
|
|
68
|
+
this.traceId,
|
|
69
|
+
disableWebPreview ?? false
|
|
70
|
+
)
|
|
66
71
|
);
|
|
67
72
|
}
|
|
68
73
|
|
|
@@ -5,16 +5,19 @@ export default class TextMessage implements IReplyMessage<string> {
|
|
|
5
5
|
chatId: number;
|
|
6
6
|
replyId: number | undefined;
|
|
7
7
|
traceId: string | number;
|
|
8
|
+
disableWebPreview: boolean;
|
|
8
9
|
|
|
9
10
|
constructor(
|
|
10
11
|
text: string,
|
|
11
12
|
chatId: number,
|
|
12
13
|
replyId: number | undefined,
|
|
13
|
-
traceId: string | number
|
|
14
|
+
traceId: string | number,
|
|
15
|
+
disableWebPreview: boolean
|
|
14
16
|
) {
|
|
15
17
|
this.content = text;
|
|
16
18
|
this.chatId = chatId;
|
|
17
19
|
this.replyId = replyId;
|
|
18
20
|
this.traceId = traceId;
|
|
21
|
+
this.disableWebPreview = disableWebPreview;
|
|
19
22
|
}
|
|
20
23
|
}
|
package/eslint.config.js
CHANGED
|
@@ -2,9 +2,9 @@ import eslint from '@eslint/js';
|
|
|
2
2
|
import tseslint from 'typescript-eslint';
|
|
3
3
|
|
|
4
4
|
export default tseslint.config(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
5
|
+
eslint.configs.recommended,
|
|
6
|
+
...tseslint.configs.recommended,
|
|
7
|
+
{
|
|
8
|
+
ignores: ['dist/*']
|
|
9
|
+
}
|
|
10
|
+
);
|
package/index.ts
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
export { startBot, stopBots } from './main';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from './helpers/timeConvertions';
|
|
10
|
-
import { IStorageClient } from './types/storage';
|
|
11
|
-
import IActionState from './types/actionState';
|
|
12
|
-
import ActionStateBase from './entities/states/actionStateBase';
|
|
13
|
-
import { Hours, Milliseconds, Seconds } from './types/timeValues';
|
|
14
|
-
|
|
15
|
-
export const helpers = {
|
|
16
|
-
hoursToMilliseconds,
|
|
17
|
-
hoursToSeconds,
|
|
18
|
-
secondsToMilliseconds
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
CommandActionBuilder,
|
|
23
|
-
CommandActionBuilderWithState,
|
|
24
|
-
ScheduledActionBuilder,
|
|
25
|
-
IStorageClient,
|
|
26
|
-
IActionState,
|
|
27
|
-
ActionStateBase,
|
|
28
|
-
Milliseconds,
|
|
29
|
-
Seconds,
|
|
30
|
-
Hours
|
|
31
|
-
};
|
|
2
|
+
export { CommandActionBuilder } from './helpers/builders/commandActionBuilder';
|
|
3
|
+
export { CommandActionBuilderWithState } from './helpers/builders/commandActionBuilder';
|
|
4
|
+
export * from './helpers/builders/scheduledActionBuilder';
|
|
5
|
+
export { IStorageClient } from './types/storage';
|
|
6
|
+
export * from './types/actionState';
|
|
7
|
+
export * from './entities/states/actionStateBase';
|
|
8
|
+
export { Hours, Milliseconds, Seconds } from './types/timeValues';
|
package/package.json
CHANGED
package/services/telegramApi.ts
CHANGED
|
@@ -88,7 +88,7 @@ export default class TelegramApiService {
|
|
|
88
88
|
{
|
|
89
89
|
reply_to_message_id: response.replyId,
|
|
90
90
|
parse_mode: 'MarkdownV2',
|
|
91
|
-
disable_web_page_preview:
|
|
91
|
+
disable_web_page_preview: response.disableWebPreview
|
|
92
92
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
93
|
} as any
|
|
94
94
|
);
|
package/types/replyMessage.ts
CHANGED
package/bun.lockb
DELETED
|
Binary file
|