Skip to content

scratchaddons-community/scradd

Repository files navigation

Scradd

About

Scradd is a custom all-in-one Discord bot for the Scratch Addons (SA) server. It has many features, such as punishments, auto moderation, “potatoboard”, XP, and much more. It also has many features specific to Scratch Addons, including addon search, suggestion utilities, fun games, tons of inside jokes, and others.

Contributors

Most of Scradd is programmed by @cobaltt7. Please run /credits for more information -- thanks to everyone listed on there!

Pull requests are welcome if you would like to help contribute. Please read through the Contributing Guidelines if you are interested in helping out.

Setup

Create a bot

  1. Visit the Discord Developer Portal and create a new application.
  2. Note the “Application ID” for future use.
  3. Go to the “Bot” tab and add a bot to the app.
  4. Highly recommended: Disable the “Public Bot” switch so random people don’t add it to their servers.
  5. Make sure to toggle all three of the Privileged Gateway Intents (the Presence, Server Members, and Message Content Intents) on.
  6. Click “Reset Token” and note it for future use.

Set up the testing server

  1. Create a new server using the Scradd Testing server template.
  2. Enable Community in Server Settings. Use #info for the Rules or Guidelines channel and #mod-logs for the Community Updates Channel.
  3. Enable Developer Mode under User Settings → Advanced.
  4. Right-click on your new testing server, copy its ID, and note it for future use.
  5. Invite your bot at https://discord.com/oauth2/authorize?client_id=[APPLICATION_ID_HERE]&guild_id=[SERVER_ID_HERE]&permissions=8&scope=applications.commands%20bot

Set up MongoDB

  1. Make a MongoDB account if you don't already have one.
  2. When asked to deploy a cluster, select a free M0 cluster and name it Scradd. All other default settings are fine.
  3. Choose to authenticate with a username and password. What you set them to doesn't matter. Note the password for future use.
  4. Choose connecting from your local environment and add your current IP address to the list. If you expect to develop from many locations, you can alternatively add 0.0.0.0/0 to allow any IPs to connect.
  5. Once the cluster is created, select “Get connection string” under “Application Development”. Copy the connection string from the modal (probably under step 3), replace <password> with your password, and note it for future use.

Set up the repository locally

  1. Download git and Node.js (v22.10+) if you haven’t already.
  2. Clone the repository using the git clone command.
  3. Install dependencies with npm install.
  4. Set up the .env file as described in global.d.ts.
  5. Code!

Development

File structure

This bot is built using strife.js and follows its recommended style guide and structure. In addition, the common directory contains code used across multiple features, and the util directory contains utility functions used across the codebase. util is different from common as its functions are not specific to this bot but could be useful in other apps as well.

Commands

Scradd has a couple of dev commands to streamline your coding.

  • node --run build: One-time build with TypeScript
  • node --run start: Run the bot
  • node --run dev: Rebuild with TypeScript on each code change
  • node --run serve: Run the bot and restart on each successful build
  • node --run format: Format code with Prettier
  • node --run lint: Lint code with ESLint
  • node --run test: Run unit tests with the Node.js native test runner