Skip to content

Latest commit

 

History

History
121 lines (93 loc) · 6.43 KB

File metadata and controls

121 lines (93 loc) · 6.43 KB

Jaybot v5.2

An open-source Discord bot for the Zombie Horde Minecraft server, built with a TypeScript + Discord.js + ExpressJS backend, React frontend, MongoDB database, and the Bun runtime.

Now powered by Elvenide's Brynjolf suite - a set of efficient, powerful, and adaptive systems for command creation, command handling, and event handling! Combined with TypeScript, this suite makes Discord bot creation easier and more powerful than ever before.

Features

Rank System

An advanced rank system that rewards users with XP when they send messages. Uses a cooldown system to ensure spamming is not rewarded. When users collect enough XP, they level up. A dynamic rank leaderboard webpage made with React allows users to see their standing in their Discord server, and compete with their fellow members for the top 3 spots on the leaderboard. XP is independently tracked monthly and all-time, allowing new members of a Discord server to still be able to compete with longtime veterans in the monthly rank leaderboards.

Rank Cards (/rank)
RANK_CARD

Monthly Rank Cards (/rankmonthly)
MONTHLY_RANK_CARD

Rank Leaderboards (/levels)
RANK_LEADERBOARDS

A live example of the Rank Leaderboards page can be found here.

Minecraft Stat Channels

A Discord category channel can be configured to contain two dynamic "stat" channels that show how many players are on the Minecraft server and whether the server is online, respectively. These stat channels automatically update every 6 minutes, allowing users to get mostly accurate information while avoiding Discord's rate limits.

Stat Channels (setup with /statadmin)
STAT_CHANNELS

Reaction Roles

An automated system that allows users to react to a Discord message to give themselves a Discord role, with no permissions necessary for normal users and a fairly simple setup process for admins.

Reaction Roles (setup with /reactionroles)
REACTION_ROLES

Suggestion Votes

An automated system that adds yes/no voting reactions to messages sent in suggestion channels that start with the term Suggestion:. This is a simpler alternative to Discord's native polls feature. Discord's polls require manually setting up yes/no options, while the Suggestion Votes system does it automatically. Discord's polls also expire after a maximum of 2 weeks, whereas the Suggestion Votes system allows users to vote indefinitely.

Suggestion Votes (only in channels named "suggestions") SUGGESTIONS

Rule Roles

An automated system that adds a specific role to a user when they accept the Discord rules popup (you must configure this in Server Settings >> Safety Setup >> DM and Spam Protection >> Members must accept rules). This can be used to easily hide content from members that refuse to agree to your rules, or to only show content to those who do accept the rules.

Getting It Yourself

Prerequisites

  • Docker
    • Download and install Docker Desktop to easily and securely run the bot with just one command
  • Bun
    • Download and install Bun
  • MongoDB
    • Create a MongoDB database, and write down the connection URL
    • Create user credentials for your database, and write down the username and password
  • Discord Bot User
    • Create a Discord bot user, and write down the bot token and application ID
  • Discord Server
    • Invite the bot to your server or a test server
  • Minecraft Server (optional)
    • If using this bot for a Minecraft server, write down the server's IP address
    • Go to src/systems/stats.ts and replace all references to Zombiehorde.net with your server's IP address
      • This will be configurable in .env in the future, but for now is hard-coded -- sorry!

Running

  1. Clone this repository
  2. Rename sample.env to .env
  3. Fill out the .env file with your info from the prerequisites (such as bot token and MongoDB credentials)
  4. Run docker compose up in the jaybot folder to start the bot
  • Add a -d flag at the end to run the bot in detached mode without seeing the logs

Note: Trying to run the bot directly using npm (or bun) scripts instead of docker compose might cause MongoDB errors if you are on Windows, due to weird issues in Bun/Node/MongoDB. Running it in Docker avoids the issue, since it uses a Linux environment.

Rebuilding

  • If you only make changes to the code:
    • Simply run docker compose up again to run the bot with your new changes
  • If you change/add/remove dependencies:
    • You'll need to rebuild the container by running docker compose up --build

Stopping

To stop the bot, run docker compose down (if in detached mode) or press Ctrl+C in the terminal (if not in detached mode).

Changelogs:

v5.2

  • Switched to Bun runtime, leading to much faster building, installation, and development
    • Discord bot backend now runs on Bun
    • React frontend is now built/bundled by Bun
  • Updated and simplified dependencies
    • Replaced several dependencies (e.g. react-scripts and tsx) with Bun
  • Integrated this repo with ElvenOps (my self-hosted CI/CD system) for continuous deployment on push to main branch
  • Simplified and improved Docker containerization by -- surprise, surprise -- using Bun
  • Switched from older docker-compose to modern docker compose commands
  • Updated logos in React frontend

v5.1

  • Fixed monthly ranks not resetting
  • Replaced hard-coded references to server-specific emojis with general emojis
  • Prevented Discord's system messages from acting as suggestion messages
  • Removed rank-clearing command to prevent abuse
  • Made running on Docker much simpler
  • Added documentation for running the bot yourself
  • Added these changelogs

v1.0-5.0

  • Added support for Minecraft server stats
  • Added support for rule roles
  • Added support for suggestion votes
  • Added support for reaction roles
  • Added support for rank cards
  • Added support for monthly rank cards
  • Added support for rank leaderboards
  • Added support for stat channels
  • Added support for rule roles
  • Added support for suggestion votes
  • Added support for reaction roles
  • Added support for rank cards
  • Added support for monthly rank cards
  • Added support for rank leaderboards
  • Added support for stat channels