/[sudobot]/trunk/docs/app/(docs)/getting-started/page.mdx
ViewVC logotype

Diff of /trunk/docs/app/(docs)/getting-started/page.mdx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 625 by rakinar2, Fri Aug 30 10:10:15 2024 UTC revision 626 by rakinar2, Sat Sep 7 09:38:45 2024 UTC
# Line 1  Line 1 
1  ---  ---
2  title: Getting Started - SudoBot  title: Getting Started
3  short_name: Getting Started  short_name: Getting Started
4  ---  ---
5    
# Line 130  DB_URL=postgresql://username:password@ho Line 130  DB_URL=postgresql://username:password@ho
130  # Replace `your-jwt-secret` with the generated secret.  # Replace `your-jwt-secret` with the generated secret.
131  JWT_SECRET=your-jwt-secret  JWT_SECRET=your-jwt-secret
132    
133    # The directory where the bot will store persistent data like
134    # configuration files, logs, and more.
135    SUDO_PREFIX=/path/to/sudobot/storage
136    
137  # Optionally, you can uncomment the following to turn on debug mode  # Optionally, you can uncomment the following to turn on debug mode
138  # to see more detailed logs, and enable certain development features.  # to see more detailed logs, and enable certain development features.
139    
# Line 146  The guild-wide configuration file is `co Line 150  The guild-wide configuration file is `co
150  The files are located at `config/` in the project root. These configuration files don't contain any specific setting, they are just a starting point for you to configure the bot.  The files are located at `config/` in the project root. These configuration files don't contain any specific setting, they are just a starting point for you to configure the bot.
151  You can edit these files to your liking.  You can edit these files to your liking.
152    
153    Then, go to the `SUDO_PREFIX` directory, and copy the `config` directory to the `SUDO_PREFIX` directory.
154    This should also copy the `config.json` and `system.json` files to the `SUDO_PREFIX` directory, that you just edited.
155    
156    **Remember, this step is important. Otherwise, any updates to the configuration files will be lost when you update the bot using Git.**
157    
158  To see all the possible configuration options, please refer to these schema files:  To see all the possible configuration options, please refer to these schema files:
159    
160  - [Guild Configuration Schema](https://github.com/onesoft-sudo/sudobot/blob/main/src/main/typescript/schemas/GuildConfigSchema.ts)  - [Guild Configuration Schema](https://github.com/onesoft-sudo/sudobot/blob/main/src/main/typescript/schemas/GuildConfigSchema.ts)
# Line 233  If using Node: Line 242  If using Node:
242  npm install -D  npm install -D
243  ```  ```
244    
245    You might get an error saying something like `symlink(): Operation not permitted` — this is fine and you can safely ignore it.
246    
247  **Build the project (Skip this if using Bun)**  **Build the project (Skip this if using Bun)**
248    
249  ```bash  ```bash
250  npm run build  npm run build
251  ```  ```
252    
253    **Copy the resource files**
254    
255    Please copy the following resources from `src` to `build`:
256    
257    * `src/main/resources` should be copied to `build/out/main` and the name should still be `resources`
258    
259  **Run the Database Migrations**  **Run the Database Migrations**
260    
261  Please first make sure you have the right credentials in your `.env` file. Then, create a new file named `migrate.ts` in the project root with the following contents:  Please first make sure you have the right credentials in your `.env` file. Then, create a new file named `migrate.ts` in the project root with the following contents:
# Line 265  Then run this file: Line 282  Then run this file:
282  bun migrate.ts  bun migrate.ts
283  ```  ```
284    
285    If you'd like to use Node.js for this, then create a `migrate.js` file instead and paste the following:
286    
287    ```javascript
288    require("dotenv/config");
289    
290    async function main() {
291        const { drizzle } = await import(String("drizzle-orm/node-postgres"));
292        const { migrate } = await import(String("drizzle-orm/node-postgres/migrator"));
293        const { Pool } = await import(String("pg"));
294        
295        const pool = new Pool({
296            connectionString: process.env.DB_URL
297        });
298        
299        const db = drizzle(pool);
300        await migrate(db, { migrationsFolder: "drizzle" });
301        await pool.end();
302    }
303    
304    main();
305    ```
306    
307    And run:
308    
309    ```bash
310    node migrate.js
311    ```
312    
313  And if everything was correctly set up, your database will have the new tables created for SudoBot.  And if everything was correctly set up, your database will have the new tables created for SudoBot.
314    
315  **Starting the Bot**  **Starting the Bot**
# Line 297  In case if you're facing issues, feel fr Line 342  In case if you're facing issues, feel fr
342    
343  -   Email: [[email protected]](mailto:[email protected])  -   Email: [[email protected]](mailto:[email protected])
344  -   Discord: [@rakinar2](https://discord.com/users/774553653394538506)  -   Discord: [@rakinar2](https://discord.com/users/774553653394538506)
345  -   Discord Servers: [Official OSN Server](https://discord.gg/JJDy9SHzGv)  -   Discord Servers: [Official OSN Server](https://sudobot.online/discord)
346    
347  Give the repository a star to show your support! We'll be really thankful if you do.  Give the repository a star to show your support! We'll be really thankful if you do.

Legend:
Removed from v.625  
changed lines
  Added in v.626

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26