17 |
|
|
18 |
## Prerequisites |
## Prerequisites |
19 |
|
|
20 |
|
<Callout type="warning"> |
21 |
|
This guide assumes you have a Linux/Unix-based system where you'll install SudoBot. Windows users, please [scroll down](#windows-compatibility) to see how you can run SudoBot on Windows. |
22 |
|
</Callout> |
23 |
|
|
24 |
Before you start, you need to have the following installed on your system: |
Before you start, you need to have the following installed on your system: |
25 |
|
|
26 |
- A Discord API Application token (bot token). Go to the [Discord Developer Portal](https://discord.com/developers/applications) to create a new application, and get the token. |
- A Discord API Application token (bot token). Go to the [Discord Developer Portal](https://discord.com/developers/applications) to create a new application, and get the token. |
75 |
Depending on your system, the build process may take a few seconds to a few minutes to complete. |
Depending on your system, the build process may take a few seconds to a few minutes to complete. |
76 |
We recommend using a system with at least 8GB of RAM and 2 CPU cores for faster build times. |
We recommend using a system with at least 8GB of RAM and 2 CPU cores for faster build times. |
77 |
|
|
78 |
If you don't have enough memory, this command might fail with heap allocation errors. If that happens, or if you don't want to build it yourself, don't worry. You can download prebuilt versions for every release. The builds are tested on Node.js **v21**, however they should also work with **v20**. |
If you don't have enough memory, this command might fail with heap allocation errors. If that happens, or if you don't want to build it yourself, don't worry. You can download prebuilt versions for every release. The builds are tested on Node.js **v22**, however they should also work with **v20** and **v21**. |
79 |
You might see that only Linux and macOS (darwin) releases are available. This doesn't mean you cannot run the bot on Windows systems - only the native bindings are platform dependent. You don't need to worry about that in most cases and the bot will just work fine. |
You might see that only Linux and macOS (darwin) releases are available. This doesn't mean you cannot run the bot on Windows systems - only the native bindings are platform dependent. You don't need to worry about that in most cases and the bot will just work fine. |
80 |
You can download the prebuilt versions in the GitHub releases page: https://github.com/onesoft-sudo/sudobot/releases/latest |
You can download the prebuilt versions in the GitHub releases page: https://github.com/onesoft-sudo/sudobot/releases/latest |
81 |
|
|
213 |
./blazew run -- -c -g |
./blazew run -- -c -g |
214 |
``` |
``` |
215 |
|
|
216 |
|
## Windows Compatibility |
217 |
|
|
218 |
|
SudoBot was created with Linux/Unix-based systems in mind, since in most cases you're going to end up running SudoBot on a production server which is usually Linux/Unix-based. |
219 |
|
However, that doesn't mean you can't run SudoBot on Windows — but please keep in mind that some things might need tweaks or you might need to do some things differently to make it work on Windows. |
220 |
|
|
221 |
|
**First of all**, BlazeBuild on Windows is still experimental, known to have some issues. So please run the following commands as alternatives: |
222 |
|
|
223 |
|
**Install dependencies** |
224 |
|
|
225 |
|
```bash |
226 |
|
bun install |
227 |
|
``` |
228 |
|
|
229 |
|
If using Node: |
230 |
|
|
231 |
|
```bash |
232 |
|
npm install -D |
233 |
|
``` |
234 |
|
|
235 |
|
**Build the project (Skip this if using Bun)** |
236 |
|
|
237 |
|
```bash |
238 |
|
npm run build |
239 |
|
``` |
240 |
|
|
241 |
|
**Run the Database Migrations** |
242 |
|
|
243 |
|
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: |
244 |
|
|
245 |
|
```typescript |
246 |
|
import "dotenv/config"; |
247 |
|
|
248 |
|
const { drizzle } = await import(String("drizzle-orm/node-postgres")); |
249 |
|
const { migrate } = await import(String("drizzle-orm/node-postgres/migrator")); |
250 |
|
const { Pool } = await import(String("pg")); |
251 |
|
|
252 |
|
const pool = new Pool({ |
253 |
|
connectionString: process.env.DB_URL |
254 |
|
}); |
255 |
|
|
256 |
|
const db = drizzle(pool); |
257 |
|
await migrate(db, { migrationsFolder: "drizzle" }); |
258 |
|
await pool.end(); |
259 |
|
``` |
260 |
|
|
261 |
|
Then run this file: |
262 |
|
|
263 |
|
```bash |
264 |
|
bun migrate.ts |
265 |
|
``` |
266 |
|
|
267 |
|
And if everything was correctly set up, your database will have the new tables created for SudoBot. |
268 |
|
|
269 |
|
**Starting the Bot** |
270 |
|
|
271 |
|
Be sure to set up the configuration files before starting the bot! After doing that, run the following: |
272 |
|
|
273 |
|
```bash |
274 |
|
bun dev |
275 |
|
``` |
276 |
|
|
277 |
|
Or, if using Node: |
278 |
|
|
279 |
|
```bash |
280 |
|
npm run start |
281 |
|
``` |
282 |
|
|
283 |
|
Also note, to pass any options that you could pass to `./blazew run`, you can just pass it normally to `bun dev` if using `bun`, or after a `--` argument if using `npm run start`. |
284 |
|
|
285 |
## Emojis |
## Emojis |
286 |
|
|
287 |
The bot uses some custom emojis and it will try to find those emojis in the Home Guild (The main server, which is configured in `HOME_GUILD_ID` environment variable). |
The bot uses some custom emojis and it will try to find those emojis in the Home Guild (The main server, which is configured in `HOME_GUILD_ID` environment variable). |