chz-telegram-bot 0.5.4 → 0.6.8
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/README.md +41 -31
- package/dist/builtin/helpAction.d.ts +2 -0
- package/dist/builtin/helpAction.d.ts.map +1 -0
- package/dist/builtin/helpAction.js +14 -0
- package/dist/dtos/chatHistoryMessage.d.ts +35 -0
- package/dist/dtos/chatHistoryMessage.d.ts.map +1 -0
- package/dist/dtos/chatHistoryMessage.js +32 -0
- package/dist/dtos/chatInfo.d.ts +17 -0
- package/dist/dtos/chatInfo.d.ts.map +1 -0
- package/dist/dtos/chatInfo.js +16 -0
- package/dist/dtos/commandTriggerCheckResult.d.ts +24 -0
- package/dist/dtos/commandTriggerCheckResult.d.ts.map +1 -0
- package/dist/dtos/commandTriggerCheckResult.js +34 -0
- package/dist/dtos/cooldownInfo.d.ts +13 -0
- package/dist/dtos/cooldownInfo.d.ts.map +1 -0
- package/dist/dtos/cooldownInfo.js +12 -0
- package/dist/dtos/incomingMessage.d.ts +19 -0
- package/dist/dtos/incomingMessage.d.ts.map +1 -0
- package/dist/dtos/incomingMessage.js +63 -0
- package/dist/dtos/incomingQuery.d.ts +10 -0
- package/dist/dtos/incomingQuery.d.ts.map +1 -0
- package/dist/dtos/incomingQuery.js +14 -0
- package/dist/dtos/messageInfo.d.ts +22 -0
- package/dist/dtos/messageInfo.d.ts.map +1 -0
- package/dist/dtos/messageInfo.js +20 -0
- package/dist/dtos/propertyProviderSets.d.ts +16 -0
- package/dist/dtos/propertyProviderSets.d.ts.map +1 -0
- package/dist/dtos/propertyProviderSets.js +1 -0
- package/dist/dtos/replyInfo.d.ts +6 -0
- package/dist/dtos/replyInfo.d.ts.map +1 -0
- package/dist/dtos/replyInfo.js +8 -0
- package/dist/dtos/responses/delay.d.ts +16 -0
- package/dist/dtos/responses/delay.d.ts.map +1 -0
- package/dist/dtos/responses/delay.js +15 -0
- package/dist/dtos/responses/imageMessage.d.ts +22 -0
- package/dist/dtos/responses/imageMessage.d.ts.map +1 -0
- package/dist/dtos/responses/imageMessage.js +21 -0
- package/dist/dtos/responses/inlineQueryResponse.d.ts +13 -0
- package/dist/dtos/responses/inlineQueryResponse.d.ts.map +1 -0
- package/dist/dtos/responses/inlineQueryResponse.js +15 -0
- package/dist/dtos/responses/reaction.d.ts +16 -0
- package/dist/dtos/responses/reaction.d.ts.map +1 -0
- package/dist/dtos/responses/reaction.js +17 -0
- package/dist/dtos/responses/textMessage.d.ts +23 -0
- package/dist/dtos/responses/textMessage.d.ts.map +1 -0
- package/dist/dtos/responses/textMessage.js +24 -0
- package/dist/dtos/responses/unpin.d.ts +15 -0
- package/dist/dtos/responses/unpin.d.ts.map +1 -0
- package/dist/dtos/responses/unpin.js +15 -0
- package/dist/dtos/responses/videoMessage.d.ts +22 -0
- package/dist/dtos/responses/videoMessage.d.ts.map +1 -0
- package/dist/dtos/responses/videoMessage.js +21 -0
- package/dist/dtos/userInfo.d.ts +12 -0
- package/dist/dtos/userInfo.d.ts.map +1 -0
- package/dist/dtos/userInfo.js +12 -0
- package/dist/entities/actions/commandAction.d.ts +31 -0
- package/dist/entities/actions/commandAction.d.ts.map +1 -0
- package/dist/entities/actions/commandAction.js +149 -0
- package/dist/entities/actions/inlineQueryAction.d.ts +14 -0
- package/dist/entities/actions/inlineQueryAction.d.ts.map +1 -0
- package/dist/entities/actions/inlineQueryAction.js +51 -0
- package/dist/entities/actions/replyCaptureAction.d.ts +15 -0
- package/dist/entities/actions/replyCaptureAction.d.ts.map +1 -0
- package/dist/entities/actions/replyCaptureAction.js +66 -0
- package/dist/entities/actions/scheduledAction.d.ts +24 -0
- package/dist/entities/actions/scheduledAction.d.ts.map +1 -0
- package/dist/entities/actions/scheduledAction.js +92 -0
- package/dist/entities/botInstance.d.ts +36 -0
- package/dist/entities/botInstance.d.ts.map +1 -0
- package/dist/entities/botInstance.js +39 -0
- package/dist/entities/cachedStateFactory.d.ts +7 -0
- package/dist/entities/cachedStateFactory.d.ts.map +1 -0
- package/dist/entities/cachedStateFactory.js +8 -0
- package/dist/entities/context/baseContext.d.ts +39 -0
- package/dist/entities/context/baseContext.d.ts.map +1 -0
- package/dist/entities/context/baseContext.js +56 -0
- package/dist/entities/context/chatContext.d.ts +50 -0
- package/dist/entities/context/chatContext.d.ts.map +1 -0
- package/dist/entities/context/chatContext.js +65 -0
- package/dist/entities/context/inlineQueryContext.d.ts +27 -0
- package/dist/entities/context/inlineQueryContext.d.ts.map +1 -0
- package/dist/entities/context/inlineQueryContext.js +29 -0
- package/dist/entities/context/messageContext.d.ts +92 -0
- package/dist/entities/context/messageContext.d.ts.map +1 -0
- package/dist/entities/context/messageContext.js +116 -0
- package/dist/entities/context/replyContext.d.ts +89 -0
- package/dist/entities/context/replyContext.d.ts.map +1 -0
- package/dist/entities/context/replyContext.js +124 -0
- package/dist/entities/states/actionStateBase.d.ts +6 -0
- package/dist/entities/states/actionStateBase.d.ts.map +1 -0
- package/dist/entities/states/actionStateBase.js +4 -0
- package/dist/entities/taskRecord.d.ts +8 -0
- package/dist/entities/taskRecord.d.ts.map +1 -0
- package/dist/entities/taskRecord.js +10 -0
- package/dist/eslint.config.d.ts +3 -0
- package/dist/eslint.config.d.ts.map +1 -0
- package/dist/eslint.config.js +51 -0
- package/dist/helpers/builders/commandActionBuilder.d.ts +100 -0
- package/dist/helpers/builders/commandActionBuilder.d.ts.map +1 -0
- package/dist/helpers/builders/commandActionBuilder.js +146 -0
- package/dist/helpers/builders/inlineQueryActionBuilder.d.ts +37 -0
- package/dist/helpers/builders/inlineQueryActionBuilder.d.ts.map +1 -0
- package/dist/helpers/builders/inlineQueryActionBuilder.js +50 -0
- package/dist/helpers/builders/scheduledActionBuilder.d.ts +68 -0
- package/dist/helpers/builders/scheduledActionBuilder.d.ts.map +1 -0
- package/dist/helpers/builders/scheduledActionBuilder.js +95 -0
- package/dist/helpers/mapUtils.d.ts +10 -0
- package/dist/helpers/mapUtils.d.ts.map +1 -0
- package/dist/helpers/mapUtils.js +13 -0
- package/dist/helpers/noop.d.ts +9 -0
- package/dist/helpers/noop.d.ts.map +1 -0
- package/dist/helpers/noop.js +17 -0
- package/dist/helpers/objectFromEntries.d.ts +2 -0
- package/dist/helpers/objectFromEntries.d.ts.map +1 -0
- package/dist/helpers/objectFromEntries.js +3 -0
- package/dist/helpers/timeConvertions.d.ts +5 -0
- package/dist/helpers/timeConvertions.d.ts.map +1 -0
- package/dist/helpers/timeConvertions.js +9 -0
- package/dist/helpers/toArray.d.ts +2 -0
- package/dist/helpers/toArray.d.ts.map +1 -0
- package/dist/helpers/toArray.js +3 -0
- package/dist/helpers/traceFactory.d.ts +3 -0
- package/dist/helpers/traceFactory.d.ts.map +1 -0
- package/dist/helpers/traceFactory.js +3 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/main.d.ts +49 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +33 -0
- package/dist/services/actionProcessingService.d.ts +25 -0
- package/dist/services/actionProcessingService.d.ts.map +1 -0
- package/dist/services/actionProcessingService.js +50 -0
- package/dist/services/actionProcessors/baseProcessor.d.ts +18 -0
- package/dist/services/actionProcessors/baseProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/baseProcessor.js +33 -0
- package/dist/services/actionProcessors/commandActionProcessor.d.ts +19 -0
- package/dist/services/actionProcessors/commandActionProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/commandActionProcessor.js +130 -0
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts +11 -0
- package/dist/services/actionProcessors/inlineQueryActionProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/inlineQueryActionProcessor.js +69 -0
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts +17 -0
- package/dist/services/actionProcessors/scheduledActionProcessor.d.ts.map +1 -0
- package/dist/services/actionProcessors/scheduledActionProcessor.js +55 -0
- package/dist/services/jsonFileStorage.d.ts +25 -0
- package/dist/services/jsonFileStorage.d.ts.map +1 -0
- package/dist/services/jsonFileStorage.js +133 -0
- package/dist/services/nodeTimeoutScheduler.d.ts +13 -0
- package/dist/services/nodeTimeoutScheduler.d.ts.map +1 -0
- package/dist/services/nodeTimeoutScheduler.js +50 -0
- package/dist/services/responseProcessingQueue.d.ts +12 -0
- package/dist/services/responseProcessingQueue.d.ts.map +1 -0
- package/dist/services/responseProcessingQueue.js +37 -0
- package/dist/services/telegramApi.d.ts +23 -0
- package/dist/services/telegramApi.d.ts.map +1 -0
- package/dist/services/telegramApi.js +163 -0
- package/dist/types/action.d.ts +14 -0
- package/dist/types/action.d.ts.map +1 -0
- package/dist/types/action.js +1 -0
- package/dist/types/actionState.d.ts +5 -0
- package/dist/types/actionState.d.ts.map +1 -0
- package/dist/types/actionState.js +1 -0
- package/dist/types/cachedValueAccessor.d.ts +2 -0
- package/dist/types/cachedValueAccessor.d.ts.map +1 -0
- package/dist/types/cachedValueAccessor.js +1 -0
- package/dist/types/capture.d.ts +24 -0
- package/dist/types/capture.d.ts.map +1 -0
- package/dist/types/capture.js +1 -0
- package/dist/types/commandCondition.d.ts +8 -0
- package/dist/types/commandCondition.d.ts.map +1 -0
- package/dist/types/commandCondition.js +1 -0
- package/dist/types/commandTrigger.d.ts +2 -0
- package/dist/types/commandTrigger.d.ts.map +1 -0
- package/dist/types/commandTrigger.js +1 -0
- package/dist/types/events.d.ts +193 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +69 -0
- package/dist/types/externalAliases.d.ts +11 -0
- package/dist/types/externalAliases.d.ts.map +1 -0
- package/dist/types/externalAliases.js +1 -0
- package/dist/types/handlers.d.ts +21 -0
- package/dist/types/handlers.d.ts.map +1 -0
- package/dist/types/handlers.js +1 -0
- package/dist/types/inputFile.d.ts +5 -0
- package/dist/types/inputFile.d.ts.map +1 -0
- package/dist/types/inputFile.js +1 -0
- package/dist/types/logger.d.ts +1 -0
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/logger.js +1 -0
- package/dist/types/messageSendingOptions.d.ts +9 -0
- package/dist/types/messageSendingOptions.d.ts.map +1 -0
- package/dist/types/messageSendingOptions.js +1 -0
- package/dist/types/messageTypes.d.ts +20 -0
- package/dist/types/messageTypes.d.ts.map +1 -0
- package/dist/types/messageTypes.js +18 -0
- package/dist/types/propertyProvider.d.ts +8 -0
- package/dist/types/propertyProvider.d.ts.map +1 -0
- package/dist/types/propertyProvider.js +1 -0
- package/dist/types/response.d.ts +39 -0
- package/dist/types/response.d.ts.map +1 -0
- package/dist/types/response.js +9 -0
- package/dist/types/scheduler.d.ts +7 -0
- package/dist/types/scheduler.d.ts.map +1 -0
- package/dist/types/scheduler.js +1 -0
- package/dist/types/storage.d.ts +11 -0
- package/dist/types/storage.d.ts.map +1 -0
- package/dist/types/storage.js +1 -0
- package/dist/types/timeValues.d.ts +15 -0
- package/dist/types/timeValues.d.ts.map +1 -0
- package/dist/types/timeValues.js +1 -0
- package/dist/types/trace.d.ts +6 -0
- package/dist/types/trace.d.ts.map +1 -0
- package/dist/types/trace.js +1 -0
- package/entities/actions/commandAction.ts +11 -3
- package/entities/actions/inlineQueryAction.ts +9 -1
- package/entities/actions/replyCaptureAction.ts +9 -3
- package/entities/actions/scheduledAction.ts +31 -10
- package/entities/botInstance.ts +18 -25
- package/entities/context/baseContext.ts +9 -4
- package/index.ts +1 -1
- package/main.ts +1 -10
- package/package.json +38 -38
- package/services/actionProcessingService.ts +11 -15
- package/services/actionProcessors/baseProcessor.ts +9 -9
- package/services/actionProcessors/commandActionProcessor.ts +35 -46
- package/services/actionProcessors/inlineQueryActionProcessor.ts +24 -20
- package/services/actionProcessors/scheduledActionProcessor.ts +5 -10
- package/services/jsonFileStorage.ts +27 -1
- package/services/nodeTimeoutScheduler.ts +22 -22
- package/services/telegramApi.ts +53 -23
- package/types/events.ts +285 -0
- package/services/jsonLogger.ts +0 -112
- package/types/logger.ts +0 -39
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# chz-bot
|
|
1
|
+
# chz-telegram-bot
|
|
2
2
|
|
|
3
3
|
[](https://deepwiki.com/AlexSolari/botFramework)
|
|
4
4
|
|
|
@@ -8,19 +8,19 @@ botFramework is a TypeScript library that provides a structured approach to buil
|
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
11
|
+
- **Type-Safe Command Building**: Fully TypeScript-supported command builders
|
|
12
|
+
- **Stateful Actions**: Built-in state management for commands, scheduled actions, and inline queries
|
|
13
|
+
- **Flexible Triggering**: Support for exact matches, regex patterns, and message types
|
|
14
|
+
- **Scheduled Tasks**: Time-based actions with customizable execution schedules
|
|
15
|
+
- **Access Control**: Built-in user and chat-based permissions
|
|
16
|
+
- **Cooldown Management**: Configurable cooldown periods for commands
|
|
17
|
+
- **Cached Values**: Process-wide caching system for optimizing resource usage
|
|
18
|
+
- **Custom State Types**: Extensible state system for complex bot logic
|
|
19
|
+
- **Comprehensive Logging**: Built-in logging system with trace IDs
|
|
20
|
+
- **Persistent Storage**: JSON-based file storage with automatic state management
|
|
21
|
+
- **Inline Query Support**: Handle inline queries with type-safe builders
|
|
22
|
+
- **Response Queue**: Managed response processing queue for reliable message delivery
|
|
23
|
+
- **Rich Media Support**: Built-in support for text, images, videos, reactions, and inline results
|
|
24
24
|
|
|
25
25
|
## Installation
|
|
26
26
|
|
|
@@ -85,8 +85,11 @@ async function main() {
|
|
|
85
85
|
const bot = await botOrchestrator.startBot({
|
|
86
86
|
name: 'MyFirstBot',
|
|
87
87
|
tokenFilePath: './token.txt',
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
actions: {
|
|
89
|
+
commands,
|
|
90
|
+
scheduled: [], // Add scheduled actions if needed
|
|
91
|
+
inlineQueries: []
|
|
92
|
+
},
|
|
90
93
|
chats: {
|
|
91
94
|
MyChat: -1001234567890 // Replace with your chat ID
|
|
92
95
|
},
|
|
@@ -96,6 +99,15 @@ async function main() {
|
|
|
96
99
|
verboseLoggingForIncomingMessage: false
|
|
97
100
|
});
|
|
98
101
|
|
|
102
|
+
// Add logging
|
|
103
|
+
bot.eventEmitter.onEach(
|
|
104
|
+
(e: string, timestamp: number, data: unknown) => {
|
|
105
|
+
console.log(
|
|
106
|
+
`${new Date(timestamp).toISOString()} - ${e} - ${JSON.stringify(data)}`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
|
|
99
111
|
// Proper cleanup on shutdown
|
|
100
112
|
const cleanup = async (signal: string) => {
|
|
101
113
|
console.log(`Received ${signal}, cleaning up...`);
|
|
@@ -199,23 +211,21 @@ This will result in `Message 1` being sent, followed by `Message 2` after a 5 se
|
|
|
199
211
|
|
|
200
212
|
When starting a bot, you can provide the following configuration:
|
|
201
213
|
|
|
202
|
-
| Option | Type
|
|
203
|
-
| ----------------- |
|
|
204
|
-
| `name` | `string`
|
|
205
|
-
| `tokenFilePath` | `string`
|
|
206
|
-
| `
|
|
207
|
-
| `
|
|
208
|
-
| `
|
|
209
|
-
| `
|
|
210
|
-
| `
|
|
211
|
-
| `services` | | No | Custom services to be used instead of default ones |
|
|
214
|
+
| Option | Type | Required | Description |
|
|
215
|
+
| ----------------- | ------------------------------------------------------------------------------------------------- | --------------------------- | -------------------------------------------------------------------------------------------- |
|
|
216
|
+
| `name` | `string` | Yes | Bot name used in logging |
|
|
217
|
+
| `tokenFilePath` | `string` | Yes | Path to file containing Telegram Bot token |
|
|
218
|
+
| `actions` | `{ commands: CommandAction[], scheduled: ScheduledAction[], inlineQueries: InlineQueryAction[] }` | Yes (can be empty) | Collection of actions grouped under `actions` — `commands`, `scheduled`, and `inlineQueries` |
|
|
219
|
+
| `chats` | `Record<string, number>` | Yes | Object containing chat name-id pairs. Used for logging and execution of scheduled action. |
|
|
220
|
+
| `storagePath` | `string` | No | Custom storage path for default JsonFileStorage client |
|
|
221
|
+
| `scheduledPeriod` | `Seconds` | No (will default to 1 hour) | Period between scheduled action executions |
|
|
222
|
+
| `services` | | No | Custom services to be used instead of default ones |
|
|
212
223
|
|
|
213
224
|
Services object should have following structure:
|
|
214
225
|
| Option | Type | Required | Description |
|
|
215
226
|
|------------------|--------------------------|----------|---------------------------------------------------------------|
|
|
216
|
-
| `storageClient` | `IStorageClient` | No (will default to `JsonFileStorage`) |
|
|
217
|
-
| `
|
|
218
|
-
| `scheduler` | `IScheduler` | No (will default to `NodeTimeoutScheduler`) | Scheduler used to scheduled action|
|
|
227
|
+
| `storageClient` | `IStorageClient` | No (will default to `JsonFileStorage`) | Persistence state provider |
|
|
228
|
+
| `scheduler` | `IScheduler` | No (will default to `NodeTimeoutScheduler`) | Scheduler used to schedule actions |
|
|
219
229
|
|
|
220
230
|
## Advanced Usage
|
|
221
231
|
|
|
@@ -287,8 +297,8 @@ All responses are queued and processed in order, ensuring proper sequencing of m
|
|
|
287
297
|
To properly terminate your bot and clean up resources:
|
|
288
298
|
|
|
289
299
|
```typescript
|
|
290
|
-
import {
|
|
300
|
+
import { botOrchestrator } from 'chz-telegram-bot';
|
|
291
301
|
|
|
292
302
|
// Call when your application is shutting down
|
|
293
|
-
await stopBots();
|
|
303
|
+
await botOrchestrator.stopBots();
|
|
294
304
|
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpAction.d.ts","sourceRoot":"","sources":["../../builtin/helpAction.ts"],"names":[],"mappings":"AAGA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,4DAatE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CommandActionBuilder } from '../helpers/builders/commandActionBuilder';
|
|
2
|
+
export function buildHelpCommand(readmes, botUsername) {
|
|
3
|
+
const helpCommandBuilder = new CommandActionBuilder('Reaction.Help')
|
|
4
|
+
.on(['/help', `/help@${botUsername}`])
|
|
5
|
+
.do((ctx) => {
|
|
6
|
+
ctx.reply.withText(readmes.join('\n\n'));
|
|
7
|
+
})
|
|
8
|
+
.withCooldown({
|
|
9
|
+
cooldown: 60
|
|
10
|
+
});
|
|
11
|
+
if (readmes.length == 0)
|
|
12
|
+
helpCommandBuilder.disabled();
|
|
13
|
+
return helpCommandBuilder.build();
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TelegramUser } from '../types/externalAliases';
|
|
2
|
+
import { MessageTypeValue } from '../types/messageTypes';
|
|
3
|
+
import { TraceId } from '../types/trace';
|
|
4
|
+
export declare class ChatHistoryMessage {
|
|
5
|
+
/** The unique identifier for the message */
|
|
6
|
+
readonly id: number;
|
|
7
|
+
/** The user who sent the message */
|
|
8
|
+
readonly from: TelegramUser | undefined;
|
|
9
|
+
/** The content of the message */
|
|
10
|
+
readonly text: string;
|
|
11
|
+
/** The type of the message */
|
|
12
|
+
readonly type: MessageTypeValue;
|
|
13
|
+
/** The trace identifier for the message */
|
|
14
|
+
readonly traceId: TraceId;
|
|
15
|
+
/** The identifier for the message this message is replying to */
|
|
16
|
+
readonly replyToId: number | undefined;
|
|
17
|
+
/** The date the message was sent, represented as a Unix timestamp */
|
|
18
|
+
readonly date: number;
|
|
19
|
+
constructor(
|
|
20
|
+
/** The unique identifier for the message */
|
|
21
|
+
id: number,
|
|
22
|
+
/** The user who sent the message */
|
|
23
|
+
from: TelegramUser | undefined,
|
|
24
|
+
/** The content of the message */
|
|
25
|
+
text: string,
|
|
26
|
+
/** The type of the message */
|
|
27
|
+
type: MessageTypeValue,
|
|
28
|
+
/** The trace identifier for the message */
|
|
29
|
+
traceId: TraceId,
|
|
30
|
+
/** The identifier for the message this message is replying to */
|
|
31
|
+
replyToId: number | undefined,
|
|
32
|
+
/** The date the message was sent, represented as a Unix timestamp */
|
|
33
|
+
date: number);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=chatHistoryMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatHistoryMessage.d.ts","sourceRoot":"","sources":["../../dtos/chatHistoryMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,kBAAkB;IAEvB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,EAAE,MAAM;IACnB,oCAAoC;IACpC,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS;IACvC,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,gBAAgB;IAC/B,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,OAAO;IACzB,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;IACtC,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM;;IAbrB,4CAA4C;IACnC,EAAE,EAAE,MAAM;IACnB,oCAAoC;IAC3B,IAAI,EAAE,YAAY,GAAG,SAAS;IACvC,iCAAiC;IACxB,IAAI,EAAE,MAAM;IACrB,8BAA8B;IACrB,IAAI,EAAE,gBAAgB;IAC/B,2CAA2C;IAClC,OAAO,EAAE,OAAO;IACzB,iEAAiE;IACxD,SAAS,EAAE,MAAM,GAAG,SAAS;IACtC,qEAAqE;IAC5D,IAAI,EAAE,MAAM;CAE5B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class ChatHistoryMessage {
|
|
2
|
+
id;
|
|
3
|
+
from;
|
|
4
|
+
text;
|
|
5
|
+
type;
|
|
6
|
+
traceId;
|
|
7
|
+
replyToId;
|
|
8
|
+
date;
|
|
9
|
+
constructor(
|
|
10
|
+
/** The unique identifier for the message */
|
|
11
|
+
id,
|
|
12
|
+
/** The user who sent the message */
|
|
13
|
+
from,
|
|
14
|
+
/** The content of the message */
|
|
15
|
+
text,
|
|
16
|
+
/** The type of the message */
|
|
17
|
+
type,
|
|
18
|
+
/** The trace identifier for the message */
|
|
19
|
+
traceId,
|
|
20
|
+
/** The identifier for the message this message is replying to */
|
|
21
|
+
replyToId,
|
|
22
|
+
/** The date the message was sent, represented as a Unix timestamp */
|
|
23
|
+
date) {
|
|
24
|
+
this.id = id;
|
|
25
|
+
this.from = from;
|
|
26
|
+
this.text = text;
|
|
27
|
+
this.type = type;
|
|
28
|
+
this.traceId = traceId;
|
|
29
|
+
this.replyToId = replyToId;
|
|
30
|
+
this.date = date;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChatHistoryMessage } from './chatHistoryMessage';
|
|
2
|
+
export declare class ChatInfo {
|
|
3
|
+
/** Id of a chat that action is executed in. */
|
|
4
|
+
readonly id: number;
|
|
5
|
+
/** Name of a chat that action is executed in. */
|
|
6
|
+
readonly name: string;
|
|
7
|
+
/** Last 100 messages in chat where action is executed */
|
|
8
|
+
readonly messageHistory: ChatHistoryMessage[];
|
|
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: ChatHistoryMessage[]);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=chatInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatInfo.d.ts","sourceRoot":"","sources":["../../dtos/chatInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,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,kBAAkB,EAAE;;IAL7C,+CAA+C;IACtC,EAAE,EAAE,MAAM;IACnB,iDAAiD;IACxC,IAAI,EAAE,MAAM;IACrB,yDAAyD;IAChD,cAAc,EAAE,kBAAkB,EAAE;CAEpD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class ChatInfo {
|
|
2
|
+
id;
|
|
3
|
+
name;
|
|
4
|
+
messageHistory;
|
|
5
|
+
constructor(
|
|
6
|
+
/** Id of a chat that action is executed in. */
|
|
7
|
+
id,
|
|
8
|
+
/** Name of a chat that action is executed in. */
|
|
9
|
+
name,
|
|
10
|
+
/** Last 100 messages in chat where action is executed */
|
|
11
|
+
messageHistory) {
|
|
12
|
+
this.id = id;
|
|
13
|
+
this.name = name;
|
|
14
|
+
this.messageHistory = messageHistory;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const _SkipTriggerReasonsObject: {
|
|
2
|
+
readonly UserIdMissing: "UserIdMissing";
|
|
3
|
+
readonly UserForbidden: "UserForbidden";
|
|
4
|
+
readonly OnCooldown: "OnCooldown";
|
|
5
|
+
readonly CustomConditionNotMet: "CustomConditionNotMet";
|
|
6
|
+
readonly TriggerNotSatisfied: "TriggerNotSatisfied";
|
|
7
|
+
readonly Other: "Other";
|
|
8
|
+
readonly ActionDisabled: "ActionDisabled";
|
|
9
|
+
readonly ChatForbidden: "ChatForbidden";
|
|
10
|
+
};
|
|
11
|
+
export type SkipTriggerReasons = keyof typeof _SkipTriggerReasonsObject;
|
|
12
|
+
export declare class CommandTriggerCheckResult {
|
|
13
|
+
readonly shouldExecute: boolean;
|
|
14
|
+
readonly matchResults: RegExpExecArray[];
|
|
15
|
+
readonly skipCooldown: boolean;
|
|
16
|
+
readonly reason?: SkipTriggerReasons | undefined;
|
|
17
|
+
static DontTriggerAndSkipCooldown(reason: SkipTriggerReasons): CommandTriggerCheckResult;
|
|
18
|
+
static DoNotTrigger(reason: SkipTriggerReasons): CommandTriggerCheckResult;
|
|
19
|
+
static Trigger(): CommandTriggerCheckResult;
|
|
20
|
+
constructor(shouldExecute: boolean, matchResults: RegExpExecArray[], skipCooldown: boolean, reason?: SkipTriggerReasons | undefined);
|
|
21
|
+
mergeWith(other: CommandTriggerCheckResult): CommandTriggerCheckResult;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=commandTriggerCheckResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandTriggerCheckResult.d.ts","sourceRoot":"","sources":["../../dtos/commandTriggerCheckResult.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,yBAAyB;;;;;;;;;CASrB,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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const _SkipTriggerReasonsObject = {
|
|
2
|
+
UserIdMissing: 'UserIdMissing',
|
|
3
|
+
UserForbidden: 'UserForbidden',
|
|
4
|
+
OnCooldown: 'OnCooldown',
|
|
5
|
+
CustomConditionNotMet: 'CustomConditionNotMet',
|
|
6
|
+
TriggerNotSatisfied: 'TriggerNotSatisfied',
|
|
7
|
+
Other: 'Other',
|
|
8
|
+
ActionDisabled: 'ActionDisabled',
|
|
9
|
+
ChatForbidden: 'ChatForbidden'
|
|
10
|
+
};
|
|
11
|
+
export class CommandTriggerCheckResult {
|
|
12
|
+
shouldExecute;
|
|
13
|
+
matchResults;
|
|
14
|
+
skipCooldown;
|
|
15
|
+
reason;
|
|
16
|
+
static DontTriggerAndSkipCooldown(reason) {
|
|
17
|
+
return new CommandTriggerCheckResult(false, [], true, reason);
|
|
18
|
+
}
|
|
19
|
+
static DoNotTrigger(reason) {
|
|
20
|
+
return new CommandTriggerCheckResult(false, [], false, reason);
|
|
21
|
+
}
|
|
22
|
+
static Trigger() {
|
|
23
|
+
return new CommandTriggerCheckResult(true, [], false);
|
|
24
|
+
}
|
|
25
|
+
constructor(shouldExecute, matchResults, skipCooldown, reason) {
|
|
26
|
+
this.shouldExecute = shouldExecute;
|
|
27
|
+
this.matchResults = matchResults;
|
|
28
|
+
this.skipCooldown = skipCooldown;
|
|
29
|
+
this.reason = reason;
|
|
30
|
+
}
|
|
31
|
+
mergeWith(other) {
|
|
32
|
+
return new CommandTriggerCheckResult(this.shouldExecute || other.shouldExecute, this.matchResults.concat(other.matchResults), this.skipCooldown || other.skipCooldown, other.reason);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Seconds } from '../types/timeValues';
|
|
2
|
+
export declare class CooldownInfo {
|
|
3
|
+
/** Cooldown configuration */
|
|
4
|
+
readonly cooldown: Seconds;
|
|
5
|
+
/** Cooldown message to be shown */
|
|
6
|
+
readonly message?: string | undefined;
|
|
7
|
+
constructor(
|
|
8
|
+
/** Cooldown configuration */
|
|
9
|
+
cooldown: Seconds,
|
|
10
|
+
/** Cooldown message to be shown */
|
|
11
|
+
message?: string | undefined);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=cooldownInfo.d.ts.map
|
|
@@ -0,0 +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;IAEjB,6BAA6B;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM;;IAHzB,6BAA6B;IACpB,QAAQ,EAAE,OAAO;IAC1B,mCAAmC;IAC1B,OAAO,CAAC,EAAE,MAAM,YAAA;CAEhC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MessageTypeValue } from '../types/messageTypes';
|
|
2
|
+
import { ChatInfo } from './chatInfo';
|
|
3
|
+
import { TraceId } from '../types/trace';
|
|
4
|
+
import { ChatHistoryMessage } from './chatHistoryMessage';
|
|
5
|
+
import { TelegramMessage, TelegramUser } from '../types/externalAliases';
|
|
6
|
+
export declare class IncomingMessage {
|
|
7
|
+
readonly messageId: number;
|
|
8
|
+
readonly chatInfo: ChatInfo;
|
|
9
|
+
readonly from: TelegramUser | undefined;
|
|
10
|
+
readonly text: string;
|
|
11
|
+
readonly type: MessageTypeValue;
|
|
12
|
+
readonly traceId: TraceId;
|
|
13
|
+
readonly replyToMessageId: number | undefined;
|
|
14
|
+
readonly updateObject: TelegramMessage;
|
|
15
|
+
private detectMessageType;
|
|
16
|
+
constructor(ctxMessage: TelegramMessage, botName: string, history: ChatHistoryMessage[]);
|
|
17
|
+
private getMessageText;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=incomingMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incomingMessage.d.ts","sourceRoot":"","sources":["../../dtos/incomingMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEzE,qBAAa,eAAe;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,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,eAAe,CAAC;IAEvC,OAAO,CAAC,iBAAiB;gBAmBrB,UAAU,EAAE,eAAe,EAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,kBAAkB,EAAE;IAyBjC,OAAO,CAAC,cAAc;CAKzB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { randomInt } from 'crypto';
|
|
2
|
+
import { MessageType } from '../types/messageTypes';
|
|
3
|
+
import { ChatInfo } from './chatInfo';
|
|
4
|
+
import { createTrace } from '../helpers/traceFactory';
|
|
5
|
+
export class IncomingMessage {
|
|
6
|
+
messageId;
|
|
7
|
+
chatInfo;
|
|
8
|
+
from;
|
|
9
|
+
text;
|
|
10
|
+
type;
|
|
11
|
+
traceId;
|
|
12
|
+
replyToMessageId;
|
|
13
|
+
updateObject;
|
|
14
|
+
detectMessageType(message) {
|
|
15
|
+
if ('forward_origin' in message)
|
|
16
|
+
return MessageType.Forward;
|
|
17
|
+
if ('text' in message)
|
|
18
|
+
return MessageType.Text;
|
|
19
|
+
if ('video' in message)
|
|
20
|
+
return MessageType.Video;
|
|
21
|
+
if ('photo' in message)
|
|
22
|
+
return MessageType.Photo;
|
|
23
|
+
if ('sticker' in message)
|
|
24
|
+
return MessageType.Sticker;
|
|
25
|
+
if ('animation' in message)
|
|
26
|
+
return MessageType.Animation;
|
|
27
|
+
if ('voice' in message)
|
|
28
|
+
return MessageType.Voice;
|
|
29
|
+
if ('audio' in message)
|
|
30
|
+
return MessageType.Audio;
|
|
31
|
+
if ('document' in message)
|
|
32
|
+
return MessageType.Document;
|
|
33
|
+
if ('left_chat_member' in message)
|
|
34
|
+
return MessageType.LeftChatMember;
|
|
35
|
+
if ('new_chat_member' in message)
|
|
36
|
+
return MessageType.NewChatMember;
|
|
37
|
+
if ('poll' in message)
|
|
38
|
+
return MessageType.Poll;
|
|
39
|
+
if ('location' in message)
|
|
40
|
+
return MessageType.Location;
|
|
41
|
+
return MessageType.Unknown;
|
|
42
|
+
}
|
|
43
|
+
constructor(ctxMessage, botName, history) {
|
|
44
|
+
this.traceId = createTrace(this, botName, randomInt(10000, 99999).toString());
|
|
45
|
+
this.messageId = ctxMessage.message_id;
|
|
46
|
+
this.replyToMessageId =
|
|
47
|
+
'reply_to_message' in ctxMessage
|
|
48
|
+
? ctxMessage.reply_to_message?.message_id
|
|
49
|
+
: undefined;
|
|
50
|
+
this.from = ctxMessage.from;
|
|
51
|
+
this.text = this.getMessageText(ctxMessage);
|
|
52
|
+
this.chatInfo = new ChatInfo(ctxMessage.chat.id, 'title' in ctxMessage.chat
|
|
53
|
+
? `${ctxMessage.chat.title} ${ctxMessage.chat.id}`
|
|
54
|
+
: 'DM', history);
|
|
55
|
+
this.type = this.detectMessageType(ctxMessage);
|
|
56
|
+
this.updateObject = ctxMessage;
|
|
57
|
+
}
|
|
58
|
+
getMessageText(ctxMessage) {
|
|
59
|
+
if ('text' in ctxMessage)
|
|
60
|
+
return ctxMessage.text;
|
|
61
|
+
return 'caption' in ctxMessage ? ctxMessage.caption ?? '' : '';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TraceId } from '../types/trace';
|
|
2
|
+
export declare class IncomingInlineQuery {
|
|
3
|
+
readonly queryId: string;
|
|
4
|
+
readonly query: string;
|
|
5
|
+
readonly userId: number;
|
|
6
|
+
readonly traceId: TraceId;
|
|
7
|
+
readonly abortController: AbortController;
|
|
8
|
+
constructor(queryId: string, query: string, userId: number, traceId: TraceId);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=incomingQuery.d.ts.map
|
|
@@ -0,0 +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;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,14 @@
|
|
|
1
|
+
export class IncomingInlineQuery {
|
|
2
|
+
queryId;
|
|
3
|
+
query;
|
|
4
|
+
userId;
|
|
5
|
+
traceId;
|
|
6
|
+
abortController;
|
|
7
|
+
constructor(queryId, query, userId, traceId) {
|
|
8
|
+
this.queryId = queryId;
|
|
9
|
+
this.query = query;
|
|
10
|
+
this.userId = userId;
|
|
11
|
+
this.traceId = traceId;
|
|
12
|
+
this.abortController = new AbortController();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TelegramMessage } from '../types/externalAliases';
|
|
2
|
+
import { MessageTypeValue } from '../types/messageTypes';
|
|
3
|
+
export declare class MessageInfo {
|
|
4
|
+
/** Id of a message that triggered this action. */
|
|
5
|
+
readonly id: number;
|
|
6
|
+
/** Text of a message that triggered this action. */
|
|
7
|
+
readonly text: string;
|
|
8
|
+
/** Type of message being received */
|
|
9
|
+
readonly type: MessageTypeValue;
|
|
10
|
+
/** Message object recieved from Telegram */
|
|
11
|
+
readonly telegramUpdateObject: TelegramMessage;
|
|
12
|
+
constructor(
|
|
13
|
+
/** Id of a message that triggered this action. */
|
|
14
|
+
id: number,
|
|
15
|
+
/** Text of a message that triggered this action. */
|
|
16
|
+
text: string,
|
|
17
|
+
/** Type of message being received */
|
|
18
|
+
type: MessageTypeValue,
|
|
19
|
+
/** Message object recieved from Telegram */
|
|
20
|
+
telegramUpdateObject: TelegramMessage);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=messageInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageInfo.d.ts","sourceRoot":"","sources":["../../dtos/messageInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,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,eAAe;;IAP9C,kDAAkD;IACzC,EAAE,EAAE,MAAM;IACnB,oDAAoD;IAC3C,IAAI,EAAE,MAAM;IACrB,qCAAqC;IAC5B,IAAI,EAAE,gBAAgB;IAC/B,4CAA4C;IACnC,oBAAoB,EAAE,eAAe;CAErD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class MessageInfo {
|
|
2
|
+
id;
|
|
3
|
+
text;
|
|
4
|
+
type;
|
|
5
|
+
telegramUpdateObject;
|
|
6
|
+
constructor(
|
|
7
|
+
/** Id of a message that triggered this action. */
|
|
8
|
+
id,
|
|
9
|
+
/** Text of a message that triggered this action. */
|
|
10
|
+
text,
|
|
11
|
+
/** Type of message being received */
|
|
12
|
+
type,
|
|
13
|
+
/** Message object recieved from Telegram */
|
|
14
|
+
telegramUpdateObject) {
|
|
15
|
+
this.id = id;
|
|
16
|
+
this.text = text;
|
|
17
|
+
this.type = type;
|
|
18
|
+
this.telegramUpdateObject = telegramUpdateObject;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CooldownInfo } from './cooldownInfo';
|
|
2
|
+
import { CommandActionPropertyProvider, ScheduledActionPropertyProvider } from '../types/propertyProvider';
|
|
3
|
+
import { HoursOfDay } from '../types/timeValues';
|
|
4
|
+
export type CommandActionProviders = {
|
|
5
|
+
cooldownProvider: CommandActionPropertyProvider<CooldownInfo>;
|
|
6
|
+
isActiveProvider: CommandActionPropertyProvider<boolean>;
|
|
7
|
+
chatsBlacklistProvider: CommandActionPropertyProvider<number[]>;
|
|
8
|
+
chatsWhitelistProvider: CommandActionPropertyProvider<number[]>;
|
|
9
|
+
usersWhitelistProvider: CommandActionPropertyProvider<number[]>;
|
|
10
|
+
};
|
|
11
|
+
export type ScheduledActionProviders = {
|
|
12
|
+
timeinHoursProvider: ScheduledActionPropertyProvider<HoursOfDay>;
|
|
13
|
+
isActiveProvider: ScheduledActionPropertyProvider<boolean>;
|
|
14
|
+
chatsWhitelistProvider: ScheduledActionPropertyProvider<number[]>;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=propertyProviderSets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertyProviderSets.d.ts","sourceRoot":"","sources":["../../dtos/propertyProviderSets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACH,6BAA6B,EAC7B,+BAA+B,EAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,MAAM,sBAAsB,GAAG;IACjC,gBAAgB,EAAE,6BAA6B,CAAC,YAAY,CAAC,CAAC;IAC9D,gBAAgB,EAAE,6BAA6B,CAAC,OAAO,CAAC,CAAC;IACzD,sBAAsB,EAAE,6BAA6B,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,sBAAsB,EAAE,6BAA6B,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,sBAAsB,EAAE,6BAA6B,CAAC,MAAM,EAAE,CAAC,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACnC,mBAAmB,EAAE,+BAA+B,CAAC,UAAU,CAAC,CAAC;IACjE,gBAAgB,EAAE,+BAA+B,CAAC,OAAO,CAAC,CAAC;IAC3D,sBAAsB,EAAE,+BAA+B,CAAC,MAAM,EAAE,CAAC,CAAC;CACrE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replyInfo.d.ts","sourceRoot":"","sources":["../../dtos/replyInfo.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAS;IAClB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEvB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;CAIzC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IActionState } from '../../types/actionState';
|
|
2
|
+
import { IActionWithState } from '../../types/action';
|
|
3
|
+
import { IChatResponse } from '../../types/response';
|
|
4
|
+
import { Milliseconds } from '../../types/timeValues';
|
|
5
|
+
import { TraceId } from '../../types/trace';
|
|
6
|
+
import { ChatInfo } from '../chatInfo';
|
|
7
|
+
export declare class DelayResponse implements IChatResponse {
|
|
8
|
+
readonly kind: "delay";
|
|
9
|
+
readonly createdAt: number;
|
|
10
|
+
readonly chatInfo: ChatInfo;
|
|
11
|
+
readonly traceId: TraceId;
|
|
12
|
+
readonly delay: Milliseconds;
|
|
13
|
+
readonly action: IActionWithState<IActionState>;
|
|
14
|
+
constructor(delay: Milliseconds, chatInfo: ChatInfo, traceId: TraceId, action: IActionWithState<IActionState>);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=delay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../../dtos/responses/delay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBAAa,aAAc,YAAW,aAAa;IAC/C,QAAQ,CAAC,IAAI,UAA0B;IACvC,QAAQ,CAAC,SAAS,SAAc;IAEhC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;gBAG5C,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC;CAO7C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BotResponseTypes } from '../../types/response';
|
|
2
|
+
export class DelayResponse {
|
|
3
|
+
kind = BotResponseTypes.delay;
|
|
4
|
+
createdAt = Date.now();
|
|
5
|
+
chatInfo;
|
|
6
|
+
traceId;
|
|
7
|
+
delay;
|
|
8
|
+
action;
|
|
9
|
+
constructor(delay, chatInfo, traceId, action) {
|
|
10
|
+
this.chatInfo = chatInfo;
|
|
11
|
+
this.delay = delay;
|
|
12
|
+
this.traceId = traceId;
|
|
13
|
+
this.action = action;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IReplyResponseWithContent } from '../../types/response';
|
|
2
|
+
import { MessageSendingOptions } from '../../types/messageSendingOptions';
|
|
3
|
+
import { IAction } from '../../types/action';
|
|
4
|
+
import { ChatInfo } from '../chatInfo';
|
|
5
|
+
import { TraceId } from '../../types/trace';
|
|
6
|
+
import { ReplyInfo } from '../replyInfo';
|
|
7
|
+
import { IReplyCapture } from '../../types/capture';
|
|
8
|
+
import { InputFile } from '../../types/inputFile';
|
|
9
|
+
export declare class ImageMessage implements IReplyResponseWithContent<InputFile> {
|
|
10
|
+
readonly kind: "image";
|
|
11
|
+
readonly createdAt: number;
|
|
12
|
+
readonly captures: IReplyCapture[];
|
|
13
|
+
readonly content: InputFile;
|
|
14
|
+
readonly chatInfo: ChatInfo;
|
|
15
|
+
readonly replyInfo: ReplyInfo | undefined;
|
|
16
|
+
readonly traceId: TraceId;
|
|
17
|
+
readonly disableWebPreview = false;
|
|
18
|
+
readonly shouldPin: boolean;
|
|
19
|
+
readonly action: IAction;
|
|
20
|
+
constructor(image: InputFile, chatInfo: ChatInfo, traceId: TraceId, action: IAction, replyInfo: ReplyInfo | undefined, options?: MessageSendingOptions);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=imageMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageMessage.d.ts","sourceRoot":"","sources":["../../../dtos/responses/imageMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,yBAAyB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,qBAAa,YAAa,YAAW,yBAAyB,CAAC,SAAS,CAAC;IACrE,QAAQ,CAAC,IAAI,UAA0B;IACvC,QAAQ,CAAC,SAAS,SAAc;IAChC,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAM;IAExC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,iBAAiB,SAAS;IACnC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAGrB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,OAAO,CAAC,EAAE,qBAAqB;CAStC"}
|