@2byte/tgbot-framework 1.0.1 → 1.0.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.
Files changed (44) hide show
  1. package/README.md +300 -300
  2. package/bin/2byte-cli.ts +97 -84
  3. package/package.json +6 -2
  4. package/src/cli/CreateBotCommand.ts +181 -181
  5. package/src/cli/GenerateCommand.ts +195 -111
  6. package/src/cli/InitCommand.ts +107 -107
  7. package/src/console/migrate.ts +82 -82
  8. package/src/core/ApiService.ts +21 -0
  9. package/src/core/ApiServiceManager.ts +63 -0
  10. package/src/core/App.ts +1113 -1042
  11. package/src/core/BotArtisan.ts +79 -79
  12. package/src/core/BotMigration.ts +30 -30
  13. package/src/core/BotSeeder.ts +66 -66
  14. package/src/core/Model.ts +84 -80
  15. package/src/core/utils.ts +2 -2
  16. package/src/illumination/Artisan.ts +149 -149
  17. package/src/illumination/InlineKeyboard.ts +61 -44
  18. package/src/illumination/Message2Byte.ts +255 -254
  19. package/src/illumination/Message2ByteLiveProgressive.ts +278 -278
  20. package/src/illumination/Message2bytePool.ts +107 -107
  21. package/src/illumination/Migration.ts +186 -186
  22. package/src/illumination/RunSectionRoute.ts +85 -85
  23. package/src/illumination/Section.ts +410 -430
  24. package/src/illumination/SectionComponent.ts +64 -64
  25. package/src/illumination/Telegraf2byteContext.ts +32 -32
  26. package/src/index.ts +35 -33
  27. package/src/libs/TelegramAccountControl.ts +738 -523
  28. package/src/types.ts +188 -186
  29. package/src/user/UserModel.ts +297 -288
  30. package/src/user/UserStore.ts +119 -119
  31. package/src/workflow/services/MassSendApiService.ts +80 -0
  32. package/templates/bot/.env.example +18 -17
  33. package/templates/bot/artisan.ts +8 -8
  34. package/templates/bot/bot.ts +79 -77
  35. package/templates/bot/database/dbConnector.ts +4 -4
  36. package/templates/bot/database/migrate.ts +9 -9
  37. package/templates/bot/database/migrations/001_create_users.sql +18 -18
  38. package/templates/bot/database/seed.ts +14 -14
  39. package/templates/bot/package.json +30 -30
  40. package/templates/bot/sectionList.ts +9 -7
  41. package/templates/bot/sections/ExampleInputSection.ts +85 -0
  42. package/templates/bot/sections/ExampleLiveTaskerSection.ts +60 -0
  43. package/templates/bot/sections/HomeSection.ts +63 -65
  44. package/templates/bot/workflow/services/ExampleServise.ts +24 -0
@@ -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
+ }