This assumes you are using VSCode as your IDE. If you have errors or issues, you can ask us for help in the #developer channel in the discord server.
- Create a discord bot account in the Discord Developer Portal.
- Remember the Application ID & Token. Both are used later in Configuration.
- If you don't save your Token you will have to reset it for a new one.
- Ensure your bot has
Privileged Gateway Intents > Server Members Intent
enabled.
- Install NvM, then use it to install NodeJS v20.15.0 OR install the nodejs version directly.
- Install Python used for multiple dependencies.
- Install Visual Studio Installer.
- Install the
Community
version. - Once downloaded select and install
Workloads > Desktop development with C++
.
- Install the
- Install Postgres 16 and pgAdmin 4 for interacting with postgres (optional, but helpful).
- Remember the Port Number and Password. Both are used later in Configuration.
- Install Yarn using:
npm i -g yarn
- Clone the repo:
git clone https://github.com/oldschoolgg/oldschoolbot.git
- Make a .env file from the example:
cp .env.example .env
- Edit this new
.env
file:- Put your test bot's Application ID into the
CLIENT_ID
field. - Put your test bot's Token into the
BOT_TOKEN
field. - Uncomment and enter the Server ID where you want to Administer your bot from into the
TESTING_SERVER_ID
field. (Skip if using official test server).
- Put your test bot's Application ID into the
- Create 2 databases called "osb_test" and "robochimp_test".
- Using pgAdmin 4 select
Servers > PostgreSQL > Databases > Create > Database...
. - Enter the database name into
Database
and hitSave
.
- Using pgAdmin 4 select
- Change
DATABASE_URL
andROBOCHIMP_DATABASE_URL
in your .env file with the formatpostgresql://USER:PASSWORD@HOST:PORT/DATABASE_NAME
. - Make a config file from the example:
cp src/config.example.ts src/config.ts
. - Edit this new
config.ts
file:- Copy your Discord ID into both
OWNER_IDS
andADMIN_IDS
. - Enter the Server ID where you want to Administer your bot from in
SupportServer
.
- Copy your Discord ID into both
- Run the following commands in the root of the repo:
corepack enable
yarn
npx prisma db push
npx prisma db push --schema ./prisma/robochimp.prisma
- Run
yarn start
oryarn watch
.
- In VSCode, press CTRL+SHIFT+P, search "Open User Settings JSON"
- Add this to the file:
// Format/fix code automatically
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
},
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Always use \n for EOF
"files.eol": "\n",
- Check your NodeJS/NPM/Yarn/Postgres versions.
- Uninstall prettier/eslint vscode plugins.
- Delete these folders: node_modules, dist.
- Your IDE may need to be ran with admin privileges.
- "yarn.psl cannot be loaded because running scripts is disabled on this sytem"
- run this command in a terminal:
Set-ExecutionPolicy Unrestricted
- run this command in a terminal:
- If either of the
npx prisma
commands fail in Finalizing Setup you may need to manually create 2 databases called "osb_test" and "robochimp_test". - Restarting your PC after Environment steps may be needed.