chz-telegram-bot 0.0.44 → 0.0.45

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.
Files changed (131) hide show
  1. package/entities/incomingMessage.ts +1 -0
  2. package/package.json +29 -29
  3. package/dist/entities/actionExecutionResult.d.ts +0 -7
  4. package/dist/entities/actionExecutionResult.d.ts.map +0 -1
  5. package/dist/entities/actionExecutionResult.js +0 -10
  6. package/dist/entities/actions/commandAction.d.ts +0 -23
  7. package/dist/entities/actions/commandAction.d.ts.map +0 -1
  8. package/dist/entities/actions/commandAction.js +0 -91
  9. package/dist/entities/actions/scheduledAction.d.ts +0 -24
  10. package/dist/entities/actions/scheduledAction.d.ts.map +0 -1
  11. package/dist/entities/actions/scheduledAction.js +0 -81
  12. package/dist/entities/botInstance.d.ts +0 -31
  13. package/dist/entities/botInstance.d.ts.map +0 -1
  14. package/dist/entities/botInstance.js +0 -107
  15. package/dist/entities/cachedStateFactory.d.ts +0 -7
  16. package/dist/entities/cachedStateFactory.d.ts.map +0 -1
  17. package/dist/entities/cachedStateFactory.js +0 -10
  18. package/dist/entities/commandTriggerCheckResult.d.ts +0 -10
  19. package/dist/entities/commandTriggerCheckResult.d.ts.map +0 -1
  20. package/dist/entities/commandTriggerCheckResult.js +0 -23
  21. package/dist/entities/context/chatContext.d.ts +0 -54
  22. package/dist/entities/context/chatContext.d.ts.map +0 -1
  23. package/dist/entities/context/chatContext.js +0 -70
  24. package/dist/entities/context/messageContext.d.ts +0 -60
  25. package/dist/entities/context/messageContext.d.ts.map +0 -1
  26. package/dist/entities/context/messageContext.js +0 -82
  27. package/dist/entities/incomingMessage.d.ts +0 -14
  28. package/dist/entities/incomingMessage.d.ts.map +0 -1
  29. package/dist/entities/incomingMessage.js +0 -43
  30. package/dist/entities/responses/imageMessage.d.ts +0 -16
  31. package/dist/entities/responses/imageMessage.d.ts.map +0 -1
  32. package/dist/entities/responses/imageMessage.js +0 -17
  33. package/dist/entities/responses/reaction.d.ts +0 -13
  34. package/dist/entities/responses/reaction.d.ts.map +0 -1
  35. package/dist/entities/responses/reaction.js +0 -15
  36. package/dist/entities/responses/textMessage.d.ts +0 -15
  37. package/dist/entities/responses/textMessage.d.ts.map +0 -1
  38. package/dist/entities/responses/textMessage.js +0 -17
  39. package/dist/entities/responses/unpin.d.ts +0 -11
  40. package/dist/entities/responses/unpin.d.ts.map +0 -1
  41. package/dist/entities/responses/unpin.js +0 -14
  42. package/dist/entities/responses/videoMessage.d.ts +0 -16
  43. package/dist/entities/responses/videoMessage.d.ts.map +0 -1
  44. package/dist/entities/responses/videoMessage.js +0 -17
  45. package/dist/entities/states/actionStateBase.d.ts +0 -6
  46. package/dist/entities/states/actionStateBase.d.ts.map +0 -1
  47. package/dist/entities/states/actionStateBase.js +0 -10
  48. package/dist/entities/taskRecord.d.ts +0 -8
  49. package/dist/entities/taskRecord.d.ts.map +0 -1
  50. package/dist/entities/taskRecord.js +0 -11
  51. package/dist/helpers/builders/commandActionBuilder.d.ts +0 -69
  52. package/dist/helpers/builders/commandActionBuilder.d.ts.map +0 -1
  53. package/dist/helpers/builders/commandActionBuilder.js +0 -96
  54. package/dist/helpers/builders/scheduledActionBuilder.d.ts +0 -60
  55. package/dist/helpers/builders/scheduledActionBuilder.d.ts.map +0 -1
  56. package/dist/helpers/builders/scheduledActionBuilder.js +0 -82
  57. package/dist/helpers/inverseRecord.d.ts +0 -2
  58. package/dist/helpers/inverseRecord.d.ts.map +0 -1
  59. package/dist/helpers/inverseRecord.js +0 -6
  60. package/dist/helpers/noop.d.ts +0 -6
  61. package/dist/helpers/noop.d.ts.map +0 -1
  62. package/dist/helpers/noop.js +0 -14
  63. package/dist/helpers/reverseMap.d.ts +0 -2
  64. package/dist/helpers/reverseMap.d.ts.map +0 -1
  65. package/dist/helpers/reverseMap.js +0 -6
  66. package/dist/helpers/reverseRecord.d.ts +0 -2
  67. package/dist/helpers/reverseRecord.d.ts.map +0 -1
  68. package/dist/helpers/reverseRecord.js +0 -6
  69. package/dist/helpers/timeConvertions.d.ts +0 -5
  70. package/dist/helpers/timeConvertions.d.ts.map +0 -1
  71. package/dist/helpers/timeConvertions.js +0 -14
  72. package/dist/helpers/toArray.d.ts +0 -2
  73. package/dist/helpers/toArray.d.ts.map +0 -1
  74. package/dist/helpers/toArray.js +0 -6
  75. package/dist/index.d.ts +0 -10
  76. package/dist/index.d.ts.map +0 -1
  77. package/dist/index.js +0 -29
  78. package/dist/main.d.ts +0 -35
  79. package/dist/main.d.ts.map +0 -1
  80. package/dist/main.js +0 -43
  81. package/dist/services/jsonFileStorage.d.ts +0 -22
  82. package/dist/services/jsonFileStorage.d.ts.map +0 -1
  83. package/dist/services/jsonFileStorage.js +0 -102
  84. package/dist/services/logger.d.ts +0 -9
  85. package/dist/services/logger.d.ts.map +0 -1
  86. package/dist/services/logger.js +0 -28
  87. package/dist/services/taskScheduler.d.ts +0 -11
  88. package/dist/services/taskScheduler.d.ts.map +0 -1
  89. package/dist/services/taskScheduler.js +0 -33
  90. package/dist/services/telegramApi.d.ts +0 -36
  91. package/dist/services/telegramApi.d.ts.map +0 -1
  92. package/dist/services/telegramApi.js +0 -100
  93. package/dist/types/actionState.d.ts +0 -5
  94. package/dist/types/actionState.d.ts.map +0 -1
  95. package/dist/types/actionState.js +0 -2
  96. package/dist/types/actionWithState.d.ts +0 -9
  97. package/dist/types/actionWithState.d.ts.map +0 -1
  98. package/dist/types/actionWithState.js +0 -2
  99. package/dist/types/cachedValueAccessor.d.ts +0 -2
  100. package/dist/types/cachedValueAccessor.d.ts.map +0 -1
  101. package/dist/types/cachedValueAccessor.js +0 -2
  102. package/dist/types/commandCondition.d.ts +0 -4
  103. package/dist/types/commandCondition.d.ts.map +0 -1
  104. package/dist/types/commandCondition.js +0 -2
  105. package/dist/types/commandTrigger.d.ts +0 -3
  106. package/dist/types/commandTrigger.d.ts.map +0 -1
  107. package/dist/types/commandTrigger.js +0 -2
  108. package/dist/types/daysOfTheWeek.d.ts +0 -10
  109. package/dist/types/daysOfTheWeek.d.ts.map +0 -1
  110. package/dist/types/daysOfTheWeek.js +0 -13
  111. package/dist/types/handlers.d.ts +0 -17
  112. package/dist/types/handlers.d.ts.map +0 -1
  113. package/dist/types/handlers.js +0 -2
  114. package/dist/types/messageSendingOptions.d.ts +0 -7
  115. package/dist/types/messageSendingOptions.d.ts.map +0 -1
  116. package/dist/types/messageSendingOptions.js +0 -2
  117. package/dist/types/messageTypes.d.ts +0 -16
  118. package/dist/types/messageTypes.d.ts.map +0 -1
  119. package/dist/types/messageTypes.js +0 -17
  120. package/dist/types/replyMessage.d.ts +0 -8
  121. package/dist/types/replyMessage.d.ts.map +0 -1
  122. package/dist/types/replyMessage.js +0 -2
  123. package/dist/types/response.d.ts +0 -27
  124. package/dist/types/response.d.ts.map +0 -1
  125. package/dist/types/response.js +0 -10
  126. package/dist/types/storage.d.ts +0 -12
  127. package/dist/types/storage.d.ts.map +0 -1
  128. package/dist/types/storage.js +0 -2
  129. package/dist/types/timeValues.d.ts +0 -11
  130. package/dist/types/timeValues.d.ts.map +0 -1
  131. package/dist/types/timeValues.js +0 -2
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChatContext = void 0;
4
- const path_1 = require("path");
5
- const imageMessage_1 = require("../responses/imageMessage");
6
- const textMessage_1 = require("../responses/textMessage");
7
- const videoMessage_1 = require("../responses/videoMessage");
8
- const unpin_1 = require("../responses/unpin");
9
- /**
10
- * Context of action executed in chat.
11
- */
12
- class ChatContext {
13
- constructor() {
14
- this.updateActions = [];
15
- this.isInitialized = false;
16
- }
17
- initializeChatContext(botName, action, interactions, chatId, chatName, traceId, storage) {
18
- this.botName = botName;
19
- this.action = action;
20
- this.interactions = interactions;
21
- this.chatId = chatId;
22
- this.chatName = chatName;
23
- this.traceId = traceId;
24
- this.storage = storage;
25
- this.updateActions = [];
26
- this.isInitialized = true;
27
- return this;
28
- }
29
- /**
30
- * Manually update the state of an action.
31
- * @param stateUpdateAction Function that will modify state.
32
- */
33
- updateState(stateUpdateAction) {
34
- this.updateActions.push(stateUpdateAction);
35
- }
36
- /**
37
- * Sends text message to chat.
38
- * @param text Message contents.
39
- * @param options Message sending option.
40
- */
41
- sendTextToChat(text, options) {
42
- this.interactions.respond(new textMessage_1.TextMessage(text, this.chatId, undefined, this.traceId, this.action, options));
43
- }
44
- /**
45
- * Sends image message to chat.
46
- * @param name Message contents.
47
- * @param options Message sending option.
48
- */
49
- sendImageToChat(name, options) {
50
- const filePath = `./content/${name}.png`;
51
- this.interactions.respond(new imageMessage_1.ImageMessage({ source: (0, path_1.resolve)(filePath) }, this.chatId, undefined, this.traceId, this.action, options));
52
- }
53
- /**
54
- * Sends video/gif message to chat.
55
- * @param name Message contents.
56
- * @param options Message sending option.
57
- */
58
- sendVideoToChat(name, options) {
59
- const filePath = `./content/${name}.mp4`;
60
- this.interactions.respond(new videoMessage_1.VideoMessage({ source: (0, path_1.resolve)(filePath) }, this.chatId, undefined, this.traceId, this.action, options));
61
- }
62
- /**
63
- * Unpins message.
64
- * @param messageId Message id.
65
- */
66
- unpinMessage(messageId) {
67
- this.interactions.unpin(new unpin_1.UnpinResponse(messageId, this.chatId, this.traceId, this.action));
68
- }
69
- }
70
- exports.ChatContext = ChatContext;
@@ -1,60 +0,0 @@
1
- import { IBotApiInteractions } from '../../services/telegramApi';
2
- import { TelegramEmoji } from 'telegraf/types';
3
- import { IStorageClient } from '../../types/storage';
4
- import { IActionState } from '../../types/actionState';
5
- import { ChatContext } from './chatContext';
6
- import { IncomingMessage } from '../incomingMessage';
7
- import { MessageSendingOptions, TextMessageSendingOptions } from '../../types/messageSendingOptions';
8
- import { IActionWithState } from '../../types/actionWithState';
9
- import { MessageTypeValue } from '../../types/messageTypes';
10
- /**
11
- * Context of action executed in chat, in response to a message
12
- */
13
- export declare class MessageContext<TActionState extends IActionState> extends ChatContext<TActionState> {
14
- /** Id of a message that triggered this action. */
15
- messageId: number;
16
- /** Text of a message that triggered this action. */
17
- messageText: string;
18
- /** Collection of Regexp match results on a message that triggered this action. Will be empty if trigger is not a Regexp. */
19
- matchResults: RegExpMatchArray[];
20
- /** Id of a user that sent a message that triggered this action. */
21
- fromUserId: number | undefined;
22
- /** Indicates if cooldown should be started after action is executed. Set to `true` by default. */
23
- startCooldown: boolean;
24
- /** Name of a user that sent a message that triggered this action. */
25
- fromUserName: string;
26
- /** Type of message being received */
27
- messageType: MessageTypeValue;
28
- constructor();
29
- initializeMessageContext(botName: string, action: IActionWithState, interactions: IBotApiInteractions, message: IncomingMessage, storage: IStorageClient): this;
30
- /**
31
- * Loads state of another action. Changes to the loaded state will no affect actual state of other action.
32
- * @param commandName Name of an action to load state of.
33
- * @template TAnotherActionState - Type of a state that is used by another action.
34
- */
35
- loadStateOf<TAnotherActionState extends IActionState>(commandName: string): Promise<TAnotherActionState>;
36
- /**
37
- * Reply with text message to message that triggered this action.
38
- * @param text Message contents.
39
- * @param options Message sending option.
40
- */
41
- replyWithText(text: string, options?: TextMessageSendingOptions): void;
42
- /**
43
- * Reply with image message to message that triggered this action.
44
- * @param text Message contents.
45
- * @param options Message sending option.
46
- */
47
- replyWithImage(name: string, options?: MessageSendingOptions): void;
48
- /**
49
- * Reply with video/gif message to message that triggered this action.
50
- * @param text Message contents.
51
- * @param options Message sending option.
52
- */
53
- replyWithVideo(name: string, options?: MessageSendingOptions): void;
54
- /**
55
- * React to the message that triggered this action.
56
- * @param emoji Telegram emoji to react with.
57
- */
58
- react(emoji: TelegramEmoji): void;
59
- }
60
- //# sourceMappingURL=messageContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messageContext.d.ts","sourceRoot":"","sources":["../../../entities/context/messageContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;A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,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAc5D;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,aAAa;CAW7B"}
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageContext = void 0;
4
- const path_1 = require("path");
5
- const imageMessage_1 = require("../responses/imageMessage");
6
- const reaction_1 = require("../responses/reaction");
7
- const textMessage_1 = require("../responses/textMessage");
8
- const videoMessage_1 = require("../responses/videoMessage");
9
- const actionStateBase_1 = require("../states/actionStateBase");
10
- const chatContext_1 = require("./chatContext");
11
- /**
12
- * Context of action executed in chat, in response to a message
13
- */
14
- class MessageContext extends chatContext_1.ChatContext {
15
- constructor() {
16
- super();
17
- /** Collection of Regexp match results on a message that triggered this action. Will be empty if trigger is not a Regexp. */
18
- this.matchResults = [];
19
- /** Indicates if cooldown should be started after action is executed. Set to `true` by default. */
20
- this.startCooldown = true;
21
- }
22
- initializeMessageContext(botName, action, interactions, message, storage) {
23
- this.messageId = message.message_id;
24
- this.messageText = message.text ?? '';
25
- this.messageType = message.type;
26
- this.fromUserId = message.from?.id;
27
- this.fromUserName =
28
- (message.from?.first_name ?? 'Unknown user') +
29
- (message.from?.last_name ? ` ${message.from.last_name}` : '');
30
- this.matchResults = [];
31
- this.startCooldown = true;
32
- return this.initializeChatContext(botName, action, interactions, message.chat.id, message.chatName, message.traceId, storage);
33
- }
34
- /**
35
- * Loads state of another action. Changes to the loaded state will no affect actual state of other action.
36
- * @param commandName Name of an action to load state of.
37
- * @template TAnotherActionState - Type of a state that is used by another action.
38
- */
39
- async loadStateOf(commandName) {
40
- const storageKey = `command:${commandName.replace('.', '-')}`;
41
- const allStates = await this.storage.load(storageKey);
42
- const stateForChat = allStates[this.chatId];
43
- if (!stateForChat) {
44
- return new actionStateBase_1.ActionStateBase();
45
- }
46
- return stateForChat;
47
- }
48
- /**
49
- * Reply with text message to message that triggered this action.
50
- * @param text Message contents.
51
- * @param options Message sending option.
52
- */
53
- replyWithText(text, options) {
54
- this.interactions.respond(new textMessage_1.TextMessage(text, this.chatId, this.messageId, this.traceId, this.action, options));
55
- }
56
- /**
57
- * Reply with image message to message that triggered this action.
58
- * @param text Message contents.
59
- * @param options Message sending option.
60
- */
61
- replyWithImage(name, options) {
62
- const filePath = `./content/${name}.png`;
63
- this.interactions.respond(new imageMessage_1.ImageMessage({ source: (0, path_1.resolve)(filePath) }, this.chatId, this.messageId, this.traceId, this.action, options));
64
- }
65
- /**
66
- * Reply with video/gif message to message that triggered this action.
67
- * @param text Message contents.
68
- * @param options Message sending option.
69
- */
70
- replyWithVideo(name, options) {
71
- const filePath = `./content/${name}.mp4`;
72
- this.interactions.respond(new videoMessage_1.VideoMessage({ source: (0, path_1.resolve)(filePath) }, this.chatId, this.messageId, this.traceId, this.action, options));
73
- }
74
- /**
75
- * React to the message that triggered this action.
76
- * @param emoji Telegram emoji to react with.
77
- */
78
- react(emoji) {
79
- this.interactions.react(new reaction_1.Reaction(this.traceId, this.chatId, this.messageId, emoji, this.action));
80
- }
81
- }
82
- exports.MessageContext = MessageContext;
@@ -1,14 +0,0 @@
1
- import { Chat, Message, Update, User } from 'telegraf/types';
2
- import { MessageTypeValue } from '../types/messageTypes';
3
- export declare class IncomingMessage {
4
- message_id: number;
5
- chat: Chat;
6
- from: User | undefined;
7
- text: string;
8
- chatName: string;
9
- type: MessageTypeValue;
10
- traceId: number;
11
- private detectMessageType;
12
- constructor(ctxMessage: Update.New & (Update.NonChannel & Message));
13
- }
14
- //# sourceMappingURL=incomingMessage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"incomingMessage.d.ts","sourceRoot":"","sources":["../../entities/incomingMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAe,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,qBAAa,eAAe;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,SAA2B;IAElC,OAAO,CAAC,iBAAiB;gBAiBb,UAAU,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC;CAWrE"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IncomingMessage = void 0;
4
- const crypto_1 = require("crypto");
5
- const messageTypes_1 = require("../types/messageTypes");
6
- class IncomingMessage {
7
- detectMessageType(message) {
8
- if ('photo' in message)
9
- return messageTypes_1.MessageType.Photo;
10
- if ('sticker' in message)
11
- return messageTypes_1.MessageType.Sticker;
12
- if ('animation' in message)
13
- return messageTypes_1.MessageType.Animation;
14
- if ('voice' in message)
15
- return messageTypes_1.MessageType.Voice;
16
- if ('audio' in message)
17
- return messageTypes_1.MessageType.Audio;
18
- if ('document' in message)
19
- return messageTypes_1.MessageType.Document;
20
- if ('left_chat_member' in message)
21
- return messageTypes_1.MessageType.LeftChatMember;
22
- if ('new_chat_member' in message)
23
- return messageTypes_1.MessageType.NewChatMember;
24
- if ('poll' in message)
25
- return messageTypes_1.MessageType.Poll;
26
- if ('location' in message)
27
- return messageTypes_1.MessageType.Location;
28
- return messageTypes_1.MessageType.Unknown;
29
- }
30
- constructor(ctxMessage) {
31
- this.traceId = (0, crypto_1.randomInt)(10000, 99999);
32
- this.message_id = ctxMessage.message_id;
33
- this.chat = ctxMessage.chat;
34
- this.from = ctxMessage.from;
35
- this.text = 'text' in ctxMessage ? ctxMessage.text : '';
36
- this.type = this.detectMessageType(ctxMessage);
37
- this.chatName =
38
- 'title' in ctxMessage.chat
39
- ? ctxMessage.chat.title + ' ' + ctxMessage.chat.id
40
- : 'DM';
41
- }
42
- }
43
- exports.IncomingMessage = IncomingMessage;
@@ -1,16 +0,0 @@
1
- import { InputFile } from 'telegraf/types';
2
- import { IReplyMessage } from '../../types/response';
3
- import { MessageSendingOptions } from '../../types/messageSendingOptions';
4
- import { IActionWithState } from '../../types/actionWithState';
5
- export declare class ImageMessage implements IReplyMessage<InputFile> {
6
- kind: "image";
7
- content: InputFile;
8
- chatId: number;
9
- replyId: number | undefined;
10
- traceId: string | number;
11
- disableWebPreview: boolean;
12
- shouldPin: boolean;
13
- action: IActionWithState;
14
- constructor(image: InputFile, chatId: number, replyId: number | undefined, traceId: number | string, action: IActionWithState, options?: MessageSendingOptions);
15
- }
16
- //# sourceMappingURL=imageMessage.d.ts.map
@@ -1 +0,0 @@
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,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBAAa,YAAa,YAAW,aAAa,CAAC,SAAS,CAAC;IACzD,IAAI,UAA0B;IAE9B,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;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,gBAAgB,CAAC;gBAGrB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,qBAAqB;CAStC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageMessage = void 0;
4
- const response_1 = require("../../types/response");
5
- class ImageMessage {
6
- constructor(image, chatId, replyId, traceId, action, options) {
7
- this.kind = response_1.BotResponseTypes.image;
8
- this.disableWebPreview = false;
9
- this.content = image;
10
- this.chatId = chatId;
11
- this.replyId = replyId;
12
- this.traceId = traceId;
13
- this.shouldPin = options?.pin ?? false;
14
- this.action = action;
15
- }
16
- }
17
- exports.ImageMessage = ImageMessage;
@@ -1,13 +0,0 @@
1
- import { TelegramEmoji } from 'telegraf/types';
2
- import { IChatResponse } from '../../types/response';
3
- import { IActionWithState } from '../../types/actionWithState';
4
- export declare class Reaction implements IChatResponse {
5
- kind: "react";
6
- chatId: number;
7
- messageId: number;
8
- traceId: number | string;
9
- emoji: TelegramEmoji;
10
- action: IActionWithState;
11
- constructor(traceId: number | string, chatId: number, messageId: number, emoji: TelegramEmoji, action: IActionWithState);
12
- }
13
- //# sourceMappingURL=reaction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../entities/responses/reaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBAAa,QAAS,YAAW,aAAa;IAC1C,IAAI,UAA0B;IAE9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;gBAGrB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,gBAAgB;CAQ/B"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Reaction = void 0;
4
- const response_1 = require("../../types/response");
5
- class Reaction {
6
- constructor(traceId, chatId, messageId, emoji, action) {
7
- this.kind = response_1.BotResponseTypes.react;
8
- this.chatId = chatId;
9
- this.messageId = messageId;
10
- this.emoji = emoji;
11
- this.traceId = traceId;
12
- this.action = action;
13
- }
14
- }
15
- exports.Reaction = Reaction;
@@ -1,15 +0,0 @@
1
- import { TextMessageSendingOptions } from '../../types/messageSendingOptions';
2
- import { IReplyMessage } from '../../types/response';
3
- import { IActionWithState } from '../../types/actionWithState';
4
- export declare class TextMessage implements IReplyMessage<string> {
5
- kind: "text";
6
- content: string;
7
- chatId: number;
8
- replyId: number | undefined;
9
- traceId: string | number;
10
- disableWebPreview: boolean;
11
- shouldPin: boolean;
12
- action: IActionWithState;
13
- constructor(text: string, chatId: number, replyId: number | undefined, traceId: string | number, action: IActionWithState, options?: TextMessageSendingOptions);
14
- }
15
- //# sourceMappingURL=textMessage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"textMessage.d.ts","sourceRoot":"","sources":["../../../entities/responses/textMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBAAa,WAAY,YAAW,aAAa,CAAC,MAAM,CAAC;IACrD,IAAI,SAAyB;IAE7B,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;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,gBAAgB,CAAC;gBAGrB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,yBAAyB;CAU1C"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextMessage = void 0;
4
- const response_1 = require("../../types/response");
5
- class TextMessage {
6
- constructor(text, chatId, replyId, traceId, action, options) {
7
- this.kind = response_1.BotResponseTypes.text;
8
- this.content = text;
9
- this.chatId = chatId;
10
- this.replyId = replyId;
11
- this.traceId = traceId;
12
- this.disableWebPreview = options?.disableWebPreview ?? false;
13
- this.shouldPin = options?.pin ?? false;
14
- this.action = action;
15
- }
16
- }
17
- exports.TextMessage = TextMessage;
@@ -1,11 +0,0 @@
1
- import { IChatResponse } from '../../types/response';
2
- import { IActionWithState } from '../../types/actionWithState';
3
- export declare class UnpinResponse implements IChatResponse {
4
- kind: "unpin";
5
- messageId: number;
6
- chatId: number;
7
- traceId: number | string;
8
- action: IActionWithState;
9
- constructor(messageId: number, chatId: number, traceId: number | string, action: IActionWithState);
10
- }
11
- //# sourceMappingURL=unpin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unpin.d.ts","sourceRoot":"","sources":["../../../entities/responses/unpin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBAAa,aAAc,YAAW,aAAa;IAC/C,IAAI,UAA0B;IAE9B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;gBAGrB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,MAAM,EAAE,gBAAgB;CAO/B"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnpinResponse = void 0;
4
- const response_1 = require("../../types/response");
5
- class UnpinResponse {
6
- constructor(messageId, chatId, traceId, action) {
7
- this.kind = response_1.BotResponseTypes.unpin;
8
- this.messageId = messageId;
9
- this.chatId = chatId;
10
- this.traceId = traceId;
11
- this.action = action;
12
- }
13
- }
14
- exports.UnpinResponse = UnpinResponse;
@@ -1,16 +0,0 @@
1
- import { InputFile } from 'telegraf/types';
2
- import { IReplyMessage } from '../../types/response';
3
- import { MessageSendingOptions } from '../../types/messageSendingOptions';
4
- import { IActionWithState } from '../../types/actionWithState';
5
- export declare class VideoMessage implements IReplyMessage<InputFile> {
6
- kind: "video";
7
- content: InputFile;
8
- chatId: number;
9
- replyId: number | undefined;
10
- traceId: string | number;
11
- disableWebPreview: boolean;
12
- shouldPin: boolean;
13
- action: IActionWithState;
14
- constructor(video: InputFile, chatId: number, replyId: number | undefined, traceId: number | string, action: IActionWithState, options?: MessageSendingOptions);
15
- }
16
- //# sourceMappingURL=videoMessage.d.ts.map
@@ -1 +0,0 @@
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,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBAAa,YAAa,YAAW,aAAa,CAAC,SAAS,CAAC;IACzD,IAAI,UAA0B;IAE9B,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;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,gBAAgB,CAAC;gBAGrB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,qBAAqB;CAStC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VideoMessage = void 0;
4
- const response_1 = require("../../types/response");
5
- class VideoMessage {
6
- constructor(video, chatId, replyId, traceId, action, options) {
7
- this.kind = response_1.BotResponseTypes.video;
8
- this.disableWebPreview = false;
9
- this.content = video;
10
- this.chatId = chatId;
11
- this.replyId = replyId;
12
- this.traceId = traceId;
13
- this.shouldPin = options?.pin ?? false;
14
- this.action = action;
15
- }
16
- }
17
- exports.VideoMessage = VideoMessage;
@@ -1,6 +0,0 @@
1
- import { IActionState } from '../../types/actionState';
2
- export declare class ActionStateBase implements IActionState {
3
- pinnedMessages: number[];
4
- lastExecutedDate: number;
5
- }
6
- //# sourceMappingURL=actionStateBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actionStateBase.d.ts","sourceRoot":"","sources":["../../../entities/states/actionStateBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qBAAa,eAAgB,YAAW,YAAY;IAChD,cAAc,EAAE,MAAM,EAAE,CAAM;IAC9B,gBAAgB,SAAK;CACxB"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionStateBase = void 0;
4
- class ActionStateBase {
5
- constructor() {
6
- this.pinnedMessages = [];
7
- this.lastExecutedDate = 0;
8
- }
9
- }
10
- exports.ActionStateBase = ActionStateBase;
@@ -1,8 +0,0 @@
1
- import { Milliseconds } from '../types/timeValues';
2
- export declare class TaskRecord {
3
- name: string;
4
- taskId: NodeJS.Timeout;
5
- interval: Milliseconds;
6
- constructor(name: string, taskId: NodeJS.Timeout, interval: Milliseconds);
7
- }
8
- //# sourceMappingURL=taskRecord.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"taskRecord.d.ts","sourceRoot":"","sources":["../../entities/taskRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,qBAAa,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;IACvB,QAAQ,EAAE,YAAY,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY;CAK3E"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TaskRecord = void 0;
4
- class TaskRecord {
5
- constructor(name, taskId, interval) {
6
- this.name = name;
7
- this.taskId = taskId;
8
- this.interval = interval;
9
- }
10
- }
11
- exports.TaskRecord = TaskRecord;
@@ -1,69 +0,0 @@
1
- import { CommandHandler } from '../../types/handlers';
2
- import { CommandCondition } from '../../types/commandCondition';
3
- import { Seconds } from '../../types/timeValues';
4
- import { CommandAction } from '../../entities/actions/commandAction';
5
- import { ActionStateBase } from '../../entities/states/actionStateBase';
6
- import { IActionState } from '../../types/actionState';
7
- import { CommandTrigger } from '../../types/commandTrigger';
8
- /**
9
- * Builder for `CommandAction` with state represented by `TActionState`
10
- */
11
- export declare class CommandActionBuilderWithState<TActionState extends IActionState> {
12
- name: string;
13
- trigger: CommandTrigger | CommandTrigger[];
14
- active: boolean;
15
- cooldownSeconds: Seconds;
16
- blacklist: number[];
17
- allowedUsers: number[];
18
- stateConstructor: () => TActionState;
19
- handler: CommandHandler<TActionState>;
20
- condition: CommandCondition<TActionState>;
21
- /**
22
- * Builder for `CommandAction` with state represented by `TActionState`
23
- * @param name Action name, will be used for logging and storage
24
- * @param stateConstructor Function that creates default state object
25
- */
26
- constructor(name: string, stateConstructor: () => TActionState);
27
- /**
28
- * Defines action trigger
29
- * @param trigger If `string` or `string[]` is provided, will be triggered only on exact message match.
30
- *
31
- * If `RegExp` or `RegExp[]` is provided, will be triggered on successful match.
32
- */
33
- on(trigger: CommandTrigger | CommandTrigger[]): this;
34
- /** Defines id (or ids) of users that are allowed to trigger this action.
35
- * @param id User id or ids
36
- */
37
- from(id: number | number[]): this;
38
- /** Defines action logic itself, will be executed on trigger.
39
- * @param handler Callback that will be called on trigger
40
- */
41
- do(handler: CommandHandler<TActionState>): this;
42
- /** Defines condition that will be checked before trigger match check is executed.
43
- * @param condition Condition check predicate
44
- */
45
- when(condition: CommandCondition<TActionState>): this;
46
- /** If called during building, action is marked as disabled and never checked. */
47
- disabled(): this;
48
- /** Sets action cooldown.
49
- * @param seconds Cooldown in seconds.
50
- */
51
- cooldown(seconds: Seconds): this;
52
- /**
53
- * Adds a chat to ignore list for this action.
54
- * @param chatId Chat id to ignore.
55
- */
56
- ignoreChat(chatId: number): this;
57
- /** Builds action */
58
- build(): CommandAction<TActionState>;
59
- }
60
- /**
61
- * Builder for `CommandAction` with state represented by default state (containing only last execution date).
62
- */
63
- export declare class CommandActionBuilder extends CommandActionBuilderWithState<ActionStateBase> {
64
- /**
65
- * Builder for `CommandAction` with state represented by default state (containing only last execution date).
66
- */
67
- constructor(name: string);
68
- }
69
- //# sourceMappingURL=commandActionBuilder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commandActionBuilder.d.ts","sourceRoot":"","sources":["../../../helpers/builders/commandActionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAA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