chz-telegram-bot 0.0.11 → 0.0.13
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/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/dist/main.d.ts +9 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +8 -8
- package/index.ts +9 -8
- package/main.ts +16 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
export { startBot, stopBots } from './main';
|
|
2
2
|
import { CommandActionBuilder } from './helpers/builders/commandActionBuilder';
|
|
3
3
|
import { CommandActionBuilderWithState } from './helpers/builders/commandActionBuilder';
|
|
4
4
|
import ScheduledActionBuilder from './helpers/builders/scheduledActionBuilder';
|
|
5
5
|
import { hoursToMilliseconds, hoursToSeconds, secondsToMilliseconds } from './helpers/timeConvertions';
|
|
6
|
-
import Noop from './helpers/noop';
|
|
7
6
|
import { IStorageClient } from './types/storage';
|
|
8
7
|
import IActionState from './types/actionState';
|
|
9
|
-
|
|
8
|
+
import ActionStateBase from './entities/states/actionStateBase';
|
|
9
|
+
import { Hours, Milliseconds, Seconds } from './types/timeValues';
|
|
10
|
+
export declare const helpers: {
|
|
10
11
|
hoursToMilliseconds: typeof hoursToMilliseconds;
|
|
11
12
|
hoursToSeconds: typeof hoursToSeconds;
|
|
12
13
|
secondsToMilliseconds: typeof secondsToMilliseconds;
|
|
13
|
-
Noop: typeof Noop;
|
|
14
14
|
};
|
|
15
|
-
export {
|
|
15
|
+
export { CommandActionBuilder, CommandActionBuilderWithState, ScheduledActionBuilder, IStorageClient, IActionState, ActionStateBase, Milliseconds, Seconds, Hours };
|
|
16
16
|
//# 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,OAAO,sBAAsB,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EACH,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,
|
|
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,OAAO,sBAAsB,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EACH,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,eAAe,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElE,eAAO,MAAM,OAAO;;;;CAInB,CAAC;AAEF,OAAO,EACH,oBAAoB,EACpB,6BAA6B,EAC7B,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,OAAO,EACP,KAAK,EACR,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.ActionStateBase = exports.ScheduledActionBuilder = exports.CommandActionBuilderWithState = exports.CommandActionBuilder = exports.helpers = exports.stopBots = exports.startBot = void 0;
|
|
7
|
+
var main_1 = require("./main");
|
|
8
8
|
Object.defineProperty(exports, "startBot", { enumerable: true, get: function () { return main_1.startBot; } });
|
|
9
9
|
Object.defineProperty(exports, "stopBots", { enumerable: true, get: function () { return main_1.stopBots; } });
|
|
10
10
|
const commandActionBuilder_1 = require("./helpers/builders/commandActionBuilder");
|
|
@@ -14,11 +14,10 @@ Object.defineProperty(exports, "CommandActionBuilderWithState", { enumerable: tr
|
|
|
14
14
|
const scheduledActionBuilder_1 = __importDefault(require("./helpers/builders/scheduledActionBuilder"));
|
|
15
15
|
exports.ScheduledActionBuilder = scheduledActionBuilder_1.default;
|
|
16
16
|
const timeConvertions_1 = require("./helpers/timeConvertions");
|
|
17
|
-
const
|
|
18
|
-
|
|
17
|
+
const actionStateBase_1 = __importDefault(require("./entities/states/actionStateBase"));
|
|
18
|
+
exports.ActionStateBase = actionStateBase_1.default;
|
|
19
|
+
exports.helpers = {
|
|
19
20
|
hoursToMilliseconds: timeConvertions_1.hoursToMilliseconds,
|
|
20
21
|
hoursToSeconds: timeConvertions_1.hoursToSeconds,
|
|
21
|
-
secondsToMilliseconds: timeConvertions_1.secondsToMilliseconds
|
|
22
|
-
Noop: noop_1.default
|
|
22
|
+
secondsToMilliseconds: timeConvertions_1.secondsToMilliseconds
|
|
23
23
|
};
|
|
24
|
-
exports.helpers = helpers;
|
package/dist/main.d.ts
CHANGED
|
@@ -3,7 +3,15 @@ import CommandAction from './entities/actions/commandAction.js';
|
|
|
3
3
|
import IActionState from './types/actionState.js';
|
|
4
4
|
import ScheduledAction from './entities/actions/scheduledAction.js';
|
|
5
5
|
import { IStorageClient } from './types/storage.js';
|
|
6
|
-
declare function startBot(
|
|
6
|
+
declare function startBot(options: {
|
|
7
|
+
name: string;
|
|
8
|
+
tokenFilePath: string;
|
|
9
|
+
commands: CommandAction<IActionState>[];
|
|
10
|
+
scheduled: ScheduledAction[];
|
|
11
|
+
chats: Map<string, number>;
|
|
12
|
+
storageClient?: IStorageClient;
|
|
13
|
+
storagePath?: string;
|
|
14
|
+
}): Promise<BotInstance>;
|
|
7
15
|
declare function stopBots(reason: string): Promise<void>;
|
|
8
16
|
export { startBot, stopBots };
|
|
9
17
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../main.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAG5C,OAAO,aAAa,MAAM,qCAAqC,CAAC;AAChE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,eAAe,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAQpD,iBAAe,QAAQ,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../main.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAG5C,OAAO,aAAa,MAAM,qCAAqC,CAAC;AAChE,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,eAAe,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAQpD,iBAAe,QAAQ,CAAC,OAAO,EAAE;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;IACxC,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,wBAcA;AAED,iBAAe,QAAQ,CAAC,MAAM,EAAE,MAAM,iBASrC;AAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/main.js
CHANGED
|
@@ -13,16 +13,16 @@ const bots = [];
|
|
|
13
13
|
function log(text) {
|
|
14
14
|
logger_js_1.default.logWithTraceId('ALL BOTS', 'System:Bot', 'System', text);
|
|
15
15
|
}
|
|
16
|
-
async function startBot(
|
|
17
|
-
const token = await (0, promises_1.readFile)(tokenFilePath, 'utf8');
|
|
16
|
+
async function startBot(options) {
|
|
17
|
+
const token = await (0, promises_1.readFile)(options.tokenFilePath, 'utf8');
|
|
18
18
|
const bot = new bot_js_1.default({
|
|
19
|
-
name,
|
|
19
|
+
name: options.name,
|
|
20
20
|
token,
|
|
21
|
-
commands,
|
|
22
|
-
scheduled,
|
|
23
|
-
chats,
|
|
24
|
-
storageClient,
|
|
25
|
-
storagePath
|
|
21
|
+
commands: options.commands,
|
|
22
|
+
scheduled: options.scheduled,
|
|
23
|
+
chats: options.chats,
|
|
24
|
+
storageClient: options.storageClient,
|
|
25
|
+
storagePath: options.storagePath
|
|
26
26
|
});
|
|
27
27
|
bots.push(bot);
|
|
28
28
|
return bot;
|
package/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export { startBot, stopBots } from './main';
|
|
2
2
|
import { CommandActionBuilder } from './helpers/builders/commandActionBuilder';
|
|
3
3
|
import { CommandActionBuilderWithState } from './helpers/builders/commandActionBuilder';
|
|
4
4
|
import ScheduledActionBuilder from './helpers/builders/scheduledActionBuilder';
|
|
@@ -7,24 +7,25 @@ import {
|
|
|
7
7
|
hoursToSeconds,
|
|
8
8
|
secondsToMilliseconds
|
|
9
9
|
} from './helpers/timeConvertions';
|
|
10
|
-
import Noop from './helpers/noop';
|
|
11
10
|
import { IStorageClient } from './types/storage';
|
|
12
11
|
import IActionState from './types/actionState';
|
|
12
|
+
import ActionStateBase from './entities/states/actionStateBase';
|
|
13
|
+
import { Hours, Milliseconds, Seconds } from './types/timeValues';
|
|
13
14
|
|
|
14
|
-
const helpers = {
|
|
15
|
+
export const helpers = {
|
|
15
16
|
hoursToMilliseconds,
|
|
16
17
|
hoursToSeconds,
|
|
17
|
-
secondsToMilliseconds
|
|
18
|
-
Noop
|
|
18
|
+
secondsToMilliseconds
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export {
|
|
22
|
-
startBot,
|
|
23
|
-
stopBots,
|
|
24
22
|
CommandActionBuilder,
|
|
25
23
|
CommandActionBuilderWithState,
|
|
26
24
|
ScheduledActionBuilder,
|
|
27
25
|
IStorageClient,
|
|
28
26
|
IActionState,
|
|
29
|
-
|
|
27
|
+
ActionStateBase,
|
|
28
|
+
Milliseconds,
|
|
29
|
+
Seconds,
|
|
30
|
+
Hours
|
|
30
31
|
};
|
package/main.ts
CHANGED
|
@@ -13,24 +13,24 @@ function log(text: string) {
|
|
|
13
13
|
logger.logWithTraceId('ALL BOTS', 'System:Bot', 'System', text);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
async function startBot(
|
|
17
|
-
name: string
|
|
18
|
-
tokenFilePath: string
|
|
19
|
-
commands: CommandAction<IActionState>[]
|
|
20
|
-
scheduled: ScheduledAction[]
|
|
21
|
-
chats: Map<string, number
|
|
22
|
-
storageClient?: IStorageClient
|
|
23
|
-
storagePath?: string
|
|
24
|
-
) {
|
|
25
|
-
const token = await readFile(tokenFilePath, 'utf8');
|
|
16
|
+
async function startBot(options: {
|
|
17
|
+
name: string;
|
|
18
|
+
tokenFilePath: string;
|
|
19
|
+
commands: CommandAction<IActionState>[];
|
|
20
|
+
scheduled: ScheduledAction[];
|
|
21
|
+
chats: Map<string, number>;
|
|
22
|
+
storageClient?: IStorageClient;
|
|
23
|
+
storagePath?: string;
|
|
24
|
+
}) {
|
|
25
|
+
const token = await readFile(options.tokenFilePath, 'utf8');
|
|
26
26
|
const bot = new BotInstance({
|
|
27
|
-
name,
|
|
27
|
+
name: options.name,
|
|
28
28
|
token,
|
|
29
|
-
commands,
|
|
30
|
-
scheduled,
|
|
31
|
-
chats,
|
|
32
|
-
storageClient,
|
|
33
|
-
storagePath
|
|
29
|
+
commands: options.commands,
|
|
30
|
+
scheduled: options.scheduled,
|
|
31
|
+
chats: options.chats,
|
|
32
|
+
storageClient: options.storageClient,
|
|
33
|
+
storagePath: options.storagePath
|
|
34
34
|
});
|
|
35
35
|
bots.push(bot);
|
|
36
36
|
|