@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,119 +1,119 @@
1
- import { UserModel } from './UserModel';
2
- import { UserSession } from '../types';
3
- import { EnvVars } from '../types';
4
-
5
- interface ApiConfig {
6
- apiUrl: string;
7
- }
8
-
9
- interface Api {
10
- fetch(endpoint: string, method?: string, data?: any): Promise<any>;
11
- }
12
-
13
- export class UserStore {
14
- private usersMap: Map<string, UserModel> = new Map();
15
- private usersSession: Map<UserModel, UserSession> = new Map();
16
- private api: Api | null = null;
17
-
18
- constructor(envConfig?: EnvVars) {
19
- if (envConfig) {
20
- let url = envConfig.BOT_API_URL || '';
21
-
22
- // Здесь должна быть инициализация API, но мы оставим это для будущей реализации
23
- // this.api = new Api({
24
- // apiUrl: url.endsWith('/') ? url : url + '/',
25
- // });
26
- }
27
- }
28
-
29
- async checkOrRegister(params: { tgUsername: string, tgId: number, tgName: string }): Promise<any> {
30
- if (!this.usersMap.has(params.tgUsername) && this.api) {
31
- let userData = null;
32
-
33
- try {
34
- let resApi = await this.api.fetch('user/get/' + params.tgUsername);
35
- userData = resApi.data;
36
- } catch (err) {
37
- let resApi = await this.api.fetch('user/register', 'post', {
38
- tg_username: params.tgUsername,
39
- tg_id: params.tgId,
40
- name: params.tgName,
41
- });
42
-
43
- userData = resApi.data;
44
- }
45
-
46
- if (userData !== null) {
47
- this.add(params.tgUsername, userData);
48
- }
49
-
50
- return userData;
51
- }
52
- return null;
53
- }
54
-
55
- find(tgUsername: string): UserModel {
56
- return this.usersMap.get(tgUsername) as UserModel;
57
- }
58
-
59
- findSession(userModel: UserModel): UserSession {
60
- return this.usersSession.get(userModel) || {};
61
- }
62
-
63
- exists(tgUsername: string): boolean {
64
- return this.usersMap.has(tgUsername);
65
- }
66
-
67
- add(tgUsername: string, data: UserModel | any): boolean {
68
- if (data instanceof UserModel) {
69
- this.usersMap.set(tgUsername, data);
70
- } else {
71
- this.usersMap.set(tgUsername, new UserModel(data));
72
- }
73
-
74
- this.usersSession.set(this.usersMap.get(tgUsername) as UserModel, {});
75
-
76
- return true;
77
- }
78
-
79
- upActive(tgUsername: string): this {
80
- const user = this.usersMap.get(tgUsername);
81
- if (user) {
82
- user.upActive();
83
- }
84
- return this;
85
- }
86
-
87
- storeMessageId(tgUsername: string, messageId: number, limit: number): this {
88
- const user = this.usersMap.get(tgUsername);
89
- if (user) {
90
- user.storeMessageId(messageId, limit);
91
- }
92
- return this;
93
- }
94
-
95
- getLastMessageId(tgUsername: string): number | undefined {
96
- const user = this.usersMap.get(tgUsername);
97
- if (user) {
98
- const ids = user.lastMessageIds;
99
- return ids.length ? ids[ids.length - 1] : undefined;
100
- }
101
- return undefined;
102
- }
103
-
104
- autocleanup(minutes: number = 1): void {
105
- const getNotActiveUsers = (): [string, UserModel][] => {
106
- return Array.from(this.usersMap).filter(([tgUsername, data]) => {
107
- return (
108
- data.serviceAttributes.lastActive.getTime() <= Date.now() - minutes * 60 * 1000
109
- );
110
- });
111
- };
112
-
113
- setInterval(() => {
114
- getNotActiveUsers().forEach(([tgUsername]) => {
115
- this.usersMap.delete(tgUsername);
116
- });
117
- }, 60 * 1000);
118
- }
119
- }
1
+ import { UserModel } from './UserModel';
2
+ import { UserSession } from '../types';
3
+ import { EnvVars } from '../types';
4
+
5
+ interface ApiConfig {
6
+ apiUrl: string;
7
+ }
8
+
9
+ interface Api {
10
+ fetch(endpoint: string, method?: string, data?: any): Promise<any>;
11
+ }
12
+
13
+ export class UserStore {
14
+ private usersMap: Map<string, UserModel> = new Map();
15
+ private usersSession: Map<UserModel, UserSession> = new Map();
16
+ private api: Api | null = null;
17
+
18
+ constructor(envConfig?: EnvVars) {
19
+ if (envConfig) {
20
+ let url = envConfig.BOT_API_URL || '';
21
+
22
+ // Здесь должна быть инициализация API, но мы оставим это для будущей реализации
23
+ // this.api = new Api({
24
+ // apiUrl: url.endsWith('/') ? url : url + '/',
25
+ // });
26
+ }
27
+ }
28
+
29
+ async checkOrRegister(params: { tgUsername: string, tgId: number, tgName: string }): Promise<any> {
30
+ if (!this.usersMap.has(params.tgUsername) && this.api) {
31
+ let userData = null;
32
+
33
+ try {
34
+ let resApi = await this.api.fetch('user/get/' + params.tgUsername);
35
+ userData = resApi.data;
36
+ } catch (err) {
37
+ let resApi = await this.api.fetch('user/register', 'post', {
38
+ tg_username: params.tgUsername,
39
+ tg_id: params.tgId,
40
+ name: params.tgName,
41
+ });
42
+
43
+ userData = resApi.data;
44
+ }
45
+
46
+ if (userData !== null) {
47
+ this.add(params.tgUsername, userData);
48
+ }
49
+
50
+ return userData;
51
+ }
52
+ return null;
53
+ }
54
+
55
+ find(tgUsername: string): UserModel {
56
+ return this.usersMap.get(tgUsername) as UserModel;
57
+ }
58
+
59
+ findSession(userModel: UserModel): UserSession {
60
+ return this.usersSession.get(userModel) || {};
61
+ }
62
+
63
+ exists(tgUsername: string): boolean {
64
+ return this.usersMap.has(tgUsername);
65
+ }
66
+
67
+ add(tgUsername: string, data: UserModel | any): boolean {
68
+ if (data instanceof UserModel) {
69
+ this.usersMap.set(tgUsername, data);
70
+ } else {
71
+ this.usersMap.set(tgUsername, new UserModel(data));
72
+ }
73
+
74
+ this.usersSession.set(this.usersMap.get(tgUsername) as UserModel, {});
75
+
76
+ return true;
77
+ }
78
+
79
+ upActive(tgUsername: string): this {
80
+ const user = this.usersMap.get(tgUsername);
81
+ if (user) {
82
+ user.upActive();
83
+ }
84
+ return this;
85
+ }
86
+
87
+ storeMessageId(tgUsername: string, messageId: number, limit: number): this {
88
+ const user = this.usersMap.get(tgUsername);
89
+ if (user) {
90
+ user.storeMessageId(messageId, limit);
91
+ }
92
+ return this;
93
+ }
94
+
95
+ getLastMessageId(tgUsername: string): number | undefined {
96
+ const user = this.usersMap.get(tgUsername);
97
+ if (user) {
98
+ const ids = user.lastMessageIds;
99
+ return ids.length ? ids[ids.length - 1] : undefined;
100
+ }
101
+ return undefined;
102
+ }
103
+
104
+ autocleanup(minutes: number = 1): void {
105
+ const getNotActiveUsers = (): [string, UserModel][] => {
106
+ return Array.from(this.usersMap).filter(([tgUsername, data]) => {
107
+ return (
108
+ data.serviceAttributes.lastActive.getTime() <= Date.now() - minutes * 60 * 1000
109
+ );
110
+ });
111
+ };
112
+
113
+ setInterval(() => {
114
+ getNotActiveUsers().forEach(([tgUsername]) => {
115
+ this.usersMap.delete(tgUsername);
116
+ });
117
+ }, 60 * 1000);
118
+ }
119
+ }
@@ -0,0 +1,80 @@
1
+ import { ApiService} from '../../core/ApiService';
2
+ import { App } from '../../core/App';
3
+ import { UserModel } from '../../user/UserModel';
4
+
5
+ export default class MassSendApiService extends ApiService {
6
+
7
+ private bunServerInstance: any;
8
+
9
+ constructor(
10
+ protected app: App,
11
+ public name: string = "MassSendApiService"
12
+ ) {
13
+ super(app, name);
14
+ }
15
+
16
+ public async setup(): Promise<void> {
17
+ return Promise.resolve();
18
+ }
19
+
20
+ public async unsetup(): Promise<void> {
21
+ return Promise.resolve();
22
+ }
23
+
24
+ public async run(): Promise<void> {
25
+ this.bunServerInstance = Bun.serve({
26
+ port: this.app.configApp.envConfig.BOT_APP_API_PORT || 3033,
27
+ routes: {
28
+ '/': async (req) => {
29
+ const receivedData = (await req.json()) as { userIds?: number[]; message?: string };
30
+ this.app.debugLog("Received data for mass message:", receivedData);
31
+
32
+ let userIds: number[] = [];
33
+ let message: string = "Hello from MassSendApiService";
34
+
35
+ if (receivedData && typeof receivedData == 'object') {
36
+ userIds = receivedData?.userIds || [];
37
+ message = receivedData?.message || "Hello from MassSendApiService";
38
+ }
39
+
40
+ this.sendMassMessage(userIds, message);
41
+
42
+ return Response.json({ status: 200, body: 'Mass message sending initiated.' });
43
+ }
44
+ }
45
+ });
46
+
47
+ this.app.debugLog(`MassSendApiService Bun server running at http://localhost:${this.bunServerInstance.port}/`);
48
+
49
+ return Promise.resolve();
50
+ }
51
+
52
+ private async sendMassMessage(userIds: number[] = [], message: string): Promise<void> {
53
+ if (userIds.length === 0) {
54
+
55
+ if (!db) {
56
+ throw new Error("Database connection is not established.");
57
+ }
58
+
59
+ UserModel.setDatabase(db);
60
+
61
+ this.app.debugLog("Fetching all users for mass message...");
62
+ const users = UserModel.getAll();
63
+
64
+ this.app.debugLog("Fetched users for mass message:", users);
65
+
66
+ if (users && users.length > 0) {
67
+ for (const user of users) {
68
+ this.app.debugLog(`Sending message to user ID: ${user.tgId} username: ${user.username}`);
69
+
70
+ try {
71
+ await this.app.bot.telegram.sendMessage(user.tgId, message);
72
+ this.app.debugLog(`Message sent to user ID: ${user.tgId} username: ${user.username}`);
73
+ } catch (error) {
74
+ this.app.debugLog(`Failed to send message to user ID: ${user.tgId} username: ${user.username}`, error);
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
@@ -1,18 +1,19 @@
1
- # Переменные окружения для {{className}} Bot
2
-
3
- # Токен бота от @BotFather
4
- BOT_TOKEN=your_bot_token_here
5
-
6
- # Путь к базе данных
7
- DATABASE_PATH=./database/database.sqlite
8
-
9
- # Настройки логирования
10
- LOG_LEVEL=info
11
-
12
- BOT_API_URL=https://localhost:3000
13
- APP_ENV=local
14
- BOT_DEV_HOT_RELOAD_SECTIONS=true
15
- BOT_ACCESS=public
16
- ACCESS_USERNAMES=stork0
17
- BOT_HOOK_DOMAIN=example.com
1
+ # Переменные окружения для {{className}} Bot
2
+
3
+ # Токен бота от @BotFather
4
+ BOT_TOKEN=your_bot_token_here
5
+
6
+ # Путь к базе данных
7
+ DATABASE_PATH=./database/database.sqlite
8
+
9
+ # Настройки логирования
10
+ LOG_LEVEL=info
11
+
12
+ BOT_APP_API_PORT=3033
13
+ BOT_API_URL=https://localhost:3000
14
+ APP_ENV=local
15
+ BOT_DEV_HOT_RELOAD_SECTIONS=true
16
+ BOT_ACCESS=public
17
+ ACCESS_USERNAMES=stork0
18
+ BOT_HOOK_DOMAIN=example.com
18
19
  BOT_HOOK_PORT=3000
@@ -1,9 +1,9 @@
1
- #!/usr/bin/env node
2
- import { BotArtisan } from '@2byte/tgbot-framework';
3
-
4
- const artisan = new BotArtisan(__dirname, {
5
- botName: '{{botName}}',
6
- sectionsPath: './sections'
7
- });
8
-
1
+ #!/usr/bin/env node
2
+ import { BotArtisan } from '@2byte/tgbot-framework';
3
+
4
+ const artisan = new BotArtisan(__dirname, {
5
+ botName: '{{botName}}',
6
+ sectionsPath: './sections'
7
+ });
8
+
9
9
  artisan.run();
@@ -1,77 +1,79 @@
1
- import { App } from '@2byte/tgbot-framework';
2
- import { UserStore } from "@2byte/tgbot-framework";
3
- import { sectionList } from "./sectionList";
4
- import { Database } from 'bun:sqlite';
5
- import { EnvVars } from "@2byte/tgbot-framework";
6
-
7
- if (import.meta.dirname === undefined) {
8
- throw new Error("import.meta.dirname is not defined. Ensure you are using a module environment.");
9
- }
10
-
11
- // check if the environment is set up correctly
12
- const requiredEnvVars: (keyof EnvVars)[] = [
13
- "BOT_TOKEN",
14
- "BOT_API_URL",
15
- "BOT_HOOK_DOMAIN",
16
- "BOT_HOOK_PORT",
17
- "BOT_ACCESS",
18
- "ACCESS_USERNAMES"
19
- ];
20
- for (const envVar of requiredEnvVars) {
21
- if (!process.env[envVar]) {
22
- throw new Error(`${envVar} is not set in the environment variables.`);
23
- }
24
- }
25
-
26
- declare global {
27
- var userStorage: UserStore;
28
- var db: Database;
29
- var settings: Record<string, any>;
30
- }
31
-
32
- // Initialize global variables
33
- global.userStorage = new UserStore(process.env as EnvVars);
34
- global.db = new Database(import.meta.dirname +'/database/database.sqlite');
35
- global.settings = {
36
- paging: {
37
- taskListPerPage: 3, // Number items per page
38
- }
39
- };
40
-
41
- // Autoclean storage user by timeout
42
- userStorage.autocleanup(10);
43
-
44
- const appController = new App.Builder()
45
- .envConfig(process.env as EnvVars)
46
- .botToken(process.env.BOT_TOKEN as string)
47
- .telegrafConfigLaunch({
48
- // webhook: {
49
- // // Public domain for webhook; e.g.: example.com
50
- // domain: process.env.BOT_HOOK_DOMAIN,
51
- // // Port to listen on; e.g.: 8080
52
- // port: +process.env.BOT_HOOK_PORT,
53
- // // Path to listen on nginx
54
- // path: "/super-mega-tgbot",
55
- // secretToken: process.env.BOT_HOOK_SECRET_TOKEN,
56
- // },
57
- })
58
- .accessPublic(process.env.BOT_ACCESS === "public")
59
- .apiUrl(process.env.BOT_API_URL as string)
60
- .settings(settings)
61
- .userStorage(userStorage)
62
- .sections(sectionList)
63
- .keepSectionInstances(true)
64
- .debug()
65
- //.telegrafLog()
66
- .devHotReloadSections(process.env.BOT_DEV_HOT_RELOAD_SECTIONS === "true")
67
- .mainMenuKeyboard([
68
- ["🏠 Лобби"],
69
- ])
70
- .hears({
71
- "🏠 Лобби": "home",
72
- })
73
- .terminateSigInt()
74
- .terminateSigTerm()
75
- .build();
76
-
77
- (await appController.init()).launch();
1
+ import { App } from '@2byte/tgbot-framework';
2
+ import { UserStore } from "@2byte/tgbot-framework";
3
+ import { sectionList } from "./sectionList";
4
+ import { Database } from 'bun:sqlite';
5
+ import { EnvVars } from "@2byte/tgbot-framework";
6
+
7
+ if (import.meta.dirname === undefined) {
8
+ throw new Error("import.meta.dirname is not defined. Ensure you are using a module environment.");
9
+ }
10
+
11
+ // check if the environment is set up correctly
12
+ const requiredEnvVars: (keyof EnvVars)[] = [
13
+ "BOT_TOKEN",
14
+ "BOT_API_URL",
15
+ "BOT_HOOK_DOMAIN",
16
+ "BOT_HOOK_PORT",
17
+ "BOT_ACCESS",
18
+ "ACCESS_USERNAMES",
19
+ "BOT_APP_API_PORT",
20
+ ];
21
+ for (const envVar of requiredEnvVars) {
22
+ if (!process.env[envVar]) {
23
+ throw new Error(`${envVar} is not set in the environment variables.`);
24
+ }
25
+ }
26
+
27
+ declare global {
28
+ var userStorage: UserStore;
29
+ var db: Database;
30
+ var settings: Record<string, any>;
31
+ }
32
+
33
+ // Initialize global variables
34
+ global.userStorage = new UserStore(process.env as EnvVars);
35
+ global.db = new Database(import.meta.dirname +'/database/database.sqlite');
36
+ global.settings = {
37
+ paging: {
38
+ taskListPerPage: 3, // Number items per page
39
+ }
40
+ };
41
+
42
+ // Autoclean storage user by timeout
43
+ userStorage.autocleanup(10);
44
+
45
+ const appController = new App.Builder()
46
+ .botCwd(import.meta.dirname)
47
+ .envConfig(process.env as EnvVars)
48
+ .botToken(process.env.BOT_TOKEN as string)
49
+ .telegrafConfigLaunch({
50
+ // webhook: {
51
+ // // Public domain for webhook; e.g.: example.com
52
+ // domain: process.env.BOT_HOOK_DOMAIN,
53
+ // // Port to listen on; e.g.: 8080
54
+ // port: +process.env.BOT_HOOK_PORT,
55
+ // // Path to listen on nginx
56
+ // path: "/super-mega-tgbot",
57
+ // secretToken: process.env.BOT_HOOK_SECRET_TOKEN,
58
+ // },
59
+ })
60
+ .accessPublic(process.env.BOT_ACCESS === "public")
61
+ .apiUrl(process.env.BOT_API_URL as string)
62
+ .settings(settings)
63
+ .userStorage(userStorage)
64
+ .sections(sectionList)
65
+ .keepSectionInstances(true)
66
+ .debug()
67
+ //.telegrafLog()
68
+ .devHotReloadSections(process.env.BOT_DEV_HOT_RELOAD_SECTIONS === "true")
69
+ .mainMenuKeyboard([
70
+ ["🏠 Лобби"],
71
+ ])
72
+ .hears({
73
+ "🏠 Лобби": "home",
74
+ })
75
+ .terminateSigInt()
76
+ .terminateSigTerm()
77
+ .build();
78
+
79
+ (await appController.init()).launch();
@@ -1,5 +1,5 @@
1
- import { Database } from 'bun:sqlite';
2
-
3
- export default () => {
4
- return new Database(import.meta.dirname + '/database.sqlite');
1
+ import { Database } from 'bun:sqlite';
2
+
3
+ export default () => {
4
+ return new Database(import.meta.dirname + '/database.sqlite');
5
5
  }
@@ -1,10 +1,10 @@
1
- import { BotMigration } from '@2byte/tgbot-framework';
2
- import path from 'path';
3
-
4
- const migration = new BotMigration({
5
- botPath: __dirname,
6
- migrationsPath: path.join(__dirname, 'migrations'),
7
- databasePath: path.join(__dirname, 'database.sqlite')
8
- });
9
-
1
+ import { BotMigration } from '@2byte/tgbot-framework';
2
+ import path from 'path';
3
+
4
+ const migration = new BotMigration({
5
+ botPath: __dirname,
6
+ migrationsPath: path.join(__dirname, 'migrations'),
7
+ databasePath: path.join(__dirname, 'database.sqlite')
8
+ });
9
+
10
10
  migration.run();
@@ -1,19 +1,19 @@
1
- -- UP
2
- CREATE TABLE IF NOT EXISTS `users` (
3
- `id` INTEGER PRIMARY KEY AUTOINCREMENT,
4
- `user_refid` INTEGER DEFAULT 0,
5
- `role` TEXT DEFAULT 'user',
6
- `tg_id` INTEGER NOT NULL UNIQUE,
7
- `tg_username` TEXT,
8
- `tg_full_name` TEXT GENERATED ALWAYS AS (trim(coalesce(tg_first_name, '') || ' ' || coalesce(tg_last_name, ''))) VIRTUAL,
9
- `tg_first_name` TEXT,
10
- `tg_last_name` TEXT,
11
- `is_banned_by_user` INTEGER DEFAULT 0,
12
- `is_banned_by_admin` INTEGER DEFAULT 0,
13
- `banned_reason` TEXT,
14
- `language` TEXT DEFAULT 'en',
15
- `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
16
- `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
17
- );
18
- -- DOWN
1
+ -- UP
2
+ CREATE TABLE IF NOT EXISTS `users` (
3
+ `id` INTEGER PRIMARY KEY AUTOINCREMENT,
4
+ `user_refid` INTEGER DEFAULT 0,
5
+ `role` TEXT DEFAULT 'user',
6
+ `tg_id` INTEGER NOT NULL UNIQUE,
7
+ `tg_username` TEXT,
8
+ `tg_full_name` TEXT GENERATED ALWAYS AS (trim(coalesce(tg_first_name, '') || ' ' || coalesce(tg_last_name, ''))) VIRTUAL,
9
+ `tg_first_name` TEXT,
10
+ `tg_last_name` TEXT,
11
+ `is_banned_by_user` INTEGER DEFAULT 0,
12
+ `is_banned_by_admin` INTEGER DEFAULT 0,
13
+ `banned_reason` TEXT,
14
+ `language` TEXT DEFAULT 'en',
15
+ `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
16
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
17
+ );
18
+ -- DOWN
19
19
  DROP TABLE IF EXISTS `users`;
@@ -1,15 +1,15 @@
1
- import { BotSeeder } from '@2byte/tgbot-framework';
2
- import path from 'path';
3
-
4
- // Импортируйте здесь ваши сидеры
5
- // import { seedUsers } from './seeds/users';
6
-
7
- const seeder = new BotSeeder({
8
- botPath: __dirname,
9
- databasePath: path.join(__dirname, 'database.sqlite'),
10
- seeders: [
11
- // seedUsers,
12
- ]
13
- });
14
-
1
+ import { BotSeeder } from '@2byte/tgbot-framework';
2
+ import path from 'path';
3
+
4
+ // Импортируйте здесь ваши сидеры
5
+ // import { seedUsers } from './seeds/users';
6
+
7
+ const seeder = new BotSeeder({
8
+ botPath: __dirname,
9
+ databasePath: path.join(__dirname, 'database.sqlite'),
10
+ seeders: [
11
+ // seedUsers,
12
+ ]
13
+ });
14
+
15
15
  seeder.run();