/main-bot

The main bot for the BuildTheEarth Discord servers.

Primary LanguageTypeScriptMIT LicenseMIT

main bot

The main bot for the BuildTheEarth Discord servers.

BuildTheEarth

Join us in this massive project as we recreate the Earth in Minecraft, in 1:1 scale, one block at a time. Discord Server

Bot

This bot is used both in the main Build The Earth server and in the staff server. It's filled with features useful for both of these, including moderation and management commands, suggestions, and utilities exclusive to our project operations.

You shouldn't use this bot on your own servers as it's heavily customized for our needs. Running the bot is not supported (unless you're planning on contributing!).

Rewrite

This project originated as a complete rewrite of our old bot, an extension of the AlphaConsole bot. As the old code was unmaintainable and riddled with bugs, we decided that a whole rewrite was the best option.

Contributors


cAttte

💻 📆

vicrobex

🎨

arc25275

🤔

metalcupcake5

💻

Noah Husby

📆

olivephio

🤔 🎨

XboxBedrock

💻

evil

💻

Mr-Smarty

💻

Fionn

🚇 💻

This project follows the All Contributors specification. Contributions of any kind are welcome!

Development

  • The bot is written in TypeScript, a statically-typed superset of JavaScript;
  • It uses discord.js for interacting with Discord's API;
  • TypeORM for object–relational mapping;
  • And it follows object-oriented and modularization principles.
  • For version control, it follows a superset of the Conventional Commits specification.

Cloning

$ git clone https://github.com/BuildTheEarth/main-bot
$ cd main-bot

Dependency setup

$ npm install

Configuration

Rename the _config.yml file to config.yml and fill in all of the fields:

  • prefix: The command prefix.
  • appeal: The ban appeal message.
  • vanity: The vanity invite code to use when level 3 boosting is reached.
  • logging: The Channel IDs where certain actions will be logged.
    • modLogs
    • snippetLogs
  • guilds: The guild IDs for the main and staff servers:
    • main
    • staff
  • suggestions: The channel IDs for the main and staff servers' suggestions channel:
    • main
    • staff
  • suggestionOffset: The numbers from where to start counting suggestions:
    • main
    • staff
  • reactionRoles: A map of the reaction roles.
    • <channel ID>
      • <message ID>
        • <emoji name>: A role ID (enclosed in quotes).
  • emojis: Emojis to use for certain occasions. They can be Unicode emojis or custom emoji IDs.
    • upvote
    • downvote
    • left
    • right
    • text: Emojis to be used in text. They can be virtually any string (but preferrably emojis).
      • online
      • idle
      • dnd
      • offline
  • colors: The color palette for message embeds.
    • success
    • error
    • info
    • suggestions
      • approved
      • denied
      • duplicate
      • forwarded
      • in-progress
      • information
      • invalid
  • assets: URLs pointing to the asset images (from /assets/). This is required as attachments are (a) a burden to work with and (b) not editable.
    • suggestions
      • approved
      • denied
      • duplicate
      • forwarded
      • in-progress
      • information
      • invalid
    • cases
      • warn
      • mute
      • kick
      • ban
      • unmute
      • unban
  • rules: A list of rules for the server (used by the rule command).
  • buildTeamInvites: A list of build team invites (map name -> invite), used by the team command. For a list scraped from our website, check out build-team-invite-scraper (make sure to indent them one level).
  • token: The Discord bot's token.
  • modpackAuth: The key for our modpack image API (required for the modpack command).
  • database: The information/credentials for connecting to the database.
    • type: The database type; mariadb, mysql, or sqlite.
    • If using MariaDB or MySQL:
      • host: The database host (most likely localhost).
      • name: The name of the database.
      • user: The username to connect with.
      • pass: The password of the user to connect with.
    • If using SQLite (recommended for easier development and testing):
      • path: The path to the database file.

Scripts

build

Compile the TypeScript code into pure JavaScript.

watch

Watch for file changes and compile the code.

start

Start the bot, from the compiled dist/ folder.

start:production

Start the bot for production with PM2, which sets the environment variable NODE_ENV to production (see ecosystem.yml).

format

Format the codebase with Prettier.

lint

Lint the codebase with ESLint.

Changelog

To follow all of the changes made to the bot since its first release, check the Changelog.

License

All of our bots are licensed under the MIT License.