@2byte/tgbot-framework 1.0.6 → 1.0.7

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 (58) hide show
  1. package/README.md +300 -300
  2. package/bin/2byte-cli.ts +97 -97
  3. package/package.json +54 -54
  4. package/src/cli/CreateBotCommand.ts +181 -181
  5. package/src/cli/GenerateCommand.ts +195 -195
  6. package/src/cli/InitCommand.ts +107 -107
  7. package/src/cli/TgAccountManager.ts +50 -50
  8. package/src/console/migrate.ts +82 -82
  9. package/src/core/ApiService.ts +20 -20
  10. package/src/core/ApiServiceManager.ts +63 -63
  11. package/src/core/App.ts +1157 -1143
  12. package/src/core/BotArtisan.ts +79 -79
  13. package/src/core/BotMigration.ts +30 -30
  14. package/src/core/BotSeeder.ts +66 -66
  15. package/src/core/Model.ts +84 -84
  16. package/src/core/utils.ts +2 -2
  17. package/src/illumination/Artisan.ts +149 -149
  18. package/src/illumination/InlineKeyboard.ts +61 -61
  19. package/src/illumination/Message2Byte.ts +255 -255
  20. package/src/illumination/Message2ByteLiveProgressive.ts +278 -278
  21. package/src/illumination/Message2bytePool.ts +107 -107
  22. package/src/illumination/Migration.ts +186 -186
  23. package/src/illumination/RunSectionRoute.ts +85 -85
  24. package/src/illumination/Section.ts +410 -410
  25. package/src/illumination/SectionComponent.ts +64 -64
  26. package/src/illumination/Telegraf2byteContext.ts +32 -32
  27. package/src/index.ts +42 -42
  28. package/src/libs/TelegramAccountControl.ts +1140 -1140
  29. package/src/libs/TgSender.ts +53 -53
  30. package/src/models/Model.ts +67 -67
  31. package/src/models/Proxy.ts +217 -217
  32. package/src/models/TgAccount.ts +362 -362
  33. package/src/models/index.ts +2 -2
  34. package/src/types.ts +191 -191
  35. package/src/user/UserModel.ts +297 -297
  36. package/src/user/UserStore.ts +119 -119
  37. package/src/workflow/services/MassSendApiService.ts +80 -80
  38. package/templates/bot/.env.example +33 -33
  39. package/templates/bot/artisan.ts +8 -8
  40. package/templates/bot/bot.ts +82 -82
  41. package/templates/bot/database/dbConnector.ts +4 -4
  42. package/templates/bot/database/migrate.ts +9 -9
  43. package/templates/bot/database/migrations/001_create_users.sql +18 -18
  44. package/templates/bot/database/migrations/007_proxy.sql +27 -27
  45. package/templates/bot/database/migrations/008_tg_accounts.sql +32 -32
  46. package/templates/bot/database/seed.ts +14 -14
  47. package/templates/bot/docs/CLI_SERVICES.md +536 -536
  48. package/templates/bot/docs/INPUT_SYSTEM.md +211 -211
  49. package/templates/bot/docs/SERVICE_EXAMPLES.md +384 -384
  50. package/templates/bot/docs/TASK_SYSTEM.md +156 -156
  51. package/templates/bot/models/Model.ts +7 -7
  52. package/templates/bot/models/index.ts +1 -1
  53. package/templates/bot/package.json +30 -30
  54. package/templates/bot/sectionList.ts +9 -9
  55. package/templates/bot/sections/ExampleInputSection.ts +85 -85
  56. package/templates/bot/sections/ExampleLiveTaskerSection.ts +60 -60
  57. package/templates/bot/sections/HomeSection.ts +63 -63
  58. package/templates/bot/workflow/services/ExampleService.ts +23 -23
@@ -1,85 +1,85 @@
1
- import { RunSectionRouteParams } from '../types';
2
-
3
- export class RunSectionRoute {
4
- private runParams: RunSectionRouteParams = {
5
- section: null,
6
- method: null,
7
- methodArgs: null,
8
- callbackParams: new URLSearchParams(),
9
- runAsCallcackQuery: false,
10
- actionPath: null,
11
- hearsKey: null,
12
- };
13
-
14
- constructor() {}
15
-
16
- section(sectionId: string): this {
17
- this.runParams.section = sectionId;
18
- return this;
19
- }
20
-
21
- method(name: string = 'index', isRunCallbackQuery: boolean = false): this {
22
- this.runParams.method = name;
23
- this.runParams.runAsCallcackQuery = isRunCallbackQuery;
24
- return this;
25
- }
26
-
27
- methodArgs(args: any[] | null): this {
28
- this.runParams.methodArgs = args;
29
- return this;
30
- }
31
-
32
- callbackParams(actionPath: string, params: string | Record<string, string>): this {
33
- this.runParams.callbackParams = new URLSearchParams(params);
34
- this.actionPath(actionPath);
35
- this.runParams.runAsCallcackQuery = true;
36
- return this;
37
- }
38
-
39
- actionPath(path: string): this {
40
- this.runParams.actionPath = path;
41
- this.runParams.runAsCallcackQuery = true;
42
- return this;
43
- }
44
-
45
- hearsKey(key: string): this {
46
- this.runParams.hearsKey = key;
47
- return this;
48
- }
49
-
50
- getMethod(): string | null {
51
- return this.runParams.method;
52
- }
53
-
54
- getSection(): string | null {
55
- return this.runParams.section;
56
- }
57
-
58
- getSectionId(): string | null {
59
- return this.runParams.section;
60
- }
61
-
62
- getCommand(): string | null {
63
- return this.runParams.method;
64
- }
65
-
66
- getSubCommand(): string | null {
67
- return this.runParams.method;
68
- }
69
-
70
- getActionPath(): string | null {
71
- return this.runParams.actionPath;
72
- }
73
-
74
- getCallbackParams(): URLSearchParams {
75
- return this.runParams.callbackParams;
76
- }
77
-
78
- getHearsKey(): string | null {
79
- return this.runParams.hearsKey;
80
- }
81
-
82
- get runIsCallbackQuery(): boolean {
83
- return this.runParams.runAsCallcackQuery;
84
- }
85
- }
1
+ import { RunSectionRouteParams } from '../types';
2
+
3
+ export class RunSectionRoute {
4
+ private runParams: RunSectionRouteParams = {
5
+ section: null,
6
+ method: null,
7
+ methodArgs: null,
8
+ callbackParams: new URLSearchParams(),
9
+ runAsCallcackQuery: false,
10
+ actionPath: null,
11
+ hearsKey: null,
12
+ };
13
+
14
+ constructor() {}
15
+
16
+ section(sectionId: string): this {
17
+ this.runParams.section = sectionId;
18
+ return this;
19
+ }
20
+
21
+ method(name: string = 'index', isRunCallbackQuery: boolean = false): this {
22
+ this.runParams.method = name;
23
+ this.runParams.runAsCallcackQuery = isRunCallbackQuery;
24
+ return this;
25
+ }
26
+
27
+ methodArgs(args: any[] | null): this {
28
+ this.runParams.methodArgs = args;
29
+ return this;
30
+ }
31
+
32
+ callbackParams(actionPath: string, params: string | Record<string, string>): this {
33
+ this.runParams.callbackParams = new URLSearchParams(params);
34
+ this.actionPath(actionPath);
35
+ this.runParams.runAsCallcackQuery = true;
36
+ return this;
37
+ }
38
+
39
+ actionPath(path: string): this {
40
+ this.runParams.actionPath = path;
41
+ this.runParams.runAsCallcackQuery = true;
42
+ return this;
43
+ }
44
+
45
+ hearsKey(key: string): this {
46
+ this.runParams.hearsKey = key;
47
+ return this;
48
+ }
49
+
50
+ getMethod(): string | null {
51
+ return this.runParams.method;
52
+ }
53
+
54
+ getSection(): string | null {
55
+ return this.runParams.section;
56
+ }
57
+
58
+ getSectionId(): string | null {
59
+ return this.runParams.section;
60
+ }
61
+
62
+ getCommand(): string | null {
63
+ return this.runParams.method;
64
+ }
65
+
66
+ getSubCommand(): string | null {
67
+ return this.runParams.method;
68
+ }
69
+
70
+ getActionPath(): string | null {
71
+ return this.runParams.actionPath;
72
+ }
73
+
74
+ getCallbackParams(): URLSearchParams {
75
+ return this.runParams.callbackParams;
76
+ }
77
+
78
+ getHearsKey(): string | null {
79
+ return this.runParams.hearsKey;
80
+ }
81
+
82
+ get runIsCallbackQuery(): boolean {
83
+ return this.runParams.runAsCallcackQuery;
84
+ }
85
+ }