chz-telegram-bot 0.1.2 → 0.1.3

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 CHANGED
@@ -195,7 +195,7 @@ const counterCommand = new CommandActionBuilderWithState<MyCustomState>(
195
195
  .on('/count')
196
196
  .do(async (ctx, state) => {
197
197
  state.counter++;
198
- ctx.replyWithText(`Count: ${state.counter}`);
198
+ await ctx.replyWithText(`Count: ${state.counter}`);
199
199
  })
200
200
  .build();
201
201
  ```
package/dist/main.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { IStorageClient } from './types/storage';
2
2
  import { CommandAction } from './entities/actions/commandAction';
3
3
  import { ScheduledAction } from './entities/actions/scheduledAction';
4
- import { IActionState } from './types/actionState';
5
4
  import { BotInstance } from './entities/botInstance';
6
5
  import { Seconds } from './types/timeValues';
7
6
  import { IScheduler } from './types/scheduler';
8
7
  import { ILogger } from './types/logger';
8
+ import { ActionStateBase } from './entities/states/actionStateBase';
9
9
  /**
10
10
  * Starts bot
11
11
  */
@@ -15,9 +15,9 @@ declare function startBot(options: {
15
15
  /** Path to file containing Telegram Bot token. */
16
16
  tokenFilePath: string;
17
17
  /** Collection of actions that will be executed as a response to message from used. Created using `CommandActionBuilder`.*/
18
- commands: CommandAction<IActionState>[];
18
+ commands: CommandAction<ActionStateBase>[];
19
19
  /** Collection of actions that will be executed on timer. Created using `ScheduledActionBuilder`.*/
20
- scheduled: ScheduledAction<IActionState>[];
20
+ scheduled: ScheduledAction<ActionStateBase>[];
21
21
  /** Object containing chat name and chat id pairs. Used for logging and execution of scheduled action. */
22
22
  chats: Record<string, number>;
23
23
  /** Storage path for default `JsonFileStorage` client. Will be used only if `storageClient` is not provided. If not provided, default value of `./storage/` will be used.*/
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC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AAQ,EAAE,QAAQ,EAAE,CAAC"}
package/main.ts CHANGED
@@ -2,11 +2,11 @@ import { readFile } from 'fs/promises';
2
2
  import { IStorageClient } from './types/storage';
3
3
  import { CommandAction } from './entities/actions/commandAction';
4
4
  import { ScheduledAction } from './entities/actions/scheduledAction';
5
- import { IActionState } from './types/actionState';
6
5
  import { BotInstance } from './entities/botInstance';
7
6
  import { Seconds } from './types/timeValues';
8
7
  import { IScheduler } from './types/scheduler';
9
8
  import { ILogger } from './types/logger';
9
+ import { ActionStateBase } from './entities/states/actionStateBase';
10
10
 
11
11
  const bots: BotInstance[] = [];
12
12
 
@@ -19,9 +19,9 @@ async function startBot(options: {
19
19
  /** Path to file containing Telegram Bot token. */
20
20
  tokenFilePath: string;
21
21
  /** Collection of actions that will be executed as a response to message from used. Created using `CommandActionBuilder`.*/
22
- commands: CommandAction<IActionState>[];
22
+ commands: CommandAction<ActionStateBase>[];
23
23
  /** Collection of actions that will be executed on timer. Created using `ScheduledActionBuilder`.*/
24
- scheduled: ScheduledAction<IActionState>[];
24
+ scheduled: ScheduledAction<ActionStateBase>[];
25
25
  /** Object containing chat name and chat id pairs. Used for logging and execution of scheduled action. */
26
26
  chats: Record<string, number>;
27
27
  /** Storage path for default `JsonFileStorage` client. Will be used only if `storageClient` is not provided. If not provided, default value of `./storage/` will be used.*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chz-telegram-bot",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "async-sema": "^3.1.1",