Skip to content

Latest commit

 

History

History
194 lines (122 loc) · 5.11 KB

File metadata and controls

194 lines (122 loc) · 5.11 KB

Choomai Bot

Some random & useless Discord bot built with discord.js.

Requirements

  • Node.js >= 20
  • MySQL 8
  • Redis

Setup

1. Clone and install dependencies

git clone https://github.com/Choomai/choomai-bot
cd choomai-bot
npm install

2. Configure environment variables

Rename .env.example to .env in the project root and modify it accordingly

3. Initialize the database

mysql -u root -p Discord < schema.sql

4. Register slash commands

npm run sync

5. Start the bot

node app.js

6. Configure a reverse proxy (e.g. NGINX)

  • Buy a domain
  • Enable HTTPS (choose either one of these):
    • Setup DNS record to point to your server, and install a certificate (Let's Encrypt is free btw)
    • Enable Proxied mode using Cloudflare, and install their Origin Certificates
  • Add rate-limiting

Expose Express server directly to the internet without a reverse proxy is not recommended, as it lacks features like HTTPS termination and rate-limiting which are essential for security and performance.


Docker

A docker-compose.yaml is provided that bundles the bot, MySQL 8, and Redis together.

# Configure enviroment variables & a reverse proxy before running.
docker compose up -d

A pre-built image is published to the GitHub Container Registry and updated automatically on every version bump at ghcr.io/choomai/choomai-bot:latest


Commands

/afk

Manages AFK timers, useful for games like VALORANT where you need to step away for a set duration.

Subcommand Description
set <time> [interval] Set your AFK timer. time and optional interval use duration syntax (e.g. 30m, 2h, 1d).
interval <time> Update the notification interval on an existing timer. Minimum 30 minutes.
check [user] Check how much time a user (or yourself) has left.
clear Cancel your AFK timer.
leaderboard Show the top 10 users with the longest remaining AFK time.

When the timer expires, the bot sends you a DM. If an interval is set, it will DM you a reminder at each interval.


/dcall

Disconnects everyone from the voice channel you are currently in.

  • Requires Move Members permission.
  • Also available as a message command: @BotName dcall
  • Has a 30 second cooldown.

/logging <channel>

Sets the channel where the bot will log command usage and automatic moderation actions.

  • Requires Manage Server permission.
  • Logs include: command issuer, command name, and auto-mute events.

/mvall <from> <to>

Moves all members from one voice channel to another.

  • from: The voice channel to move members from
  • to: The voice channel to move members to
  • Requires Move Members permission.

/ping

Replies with Pong!. Useful for checking if the bot is alive.


/status

Displays the live status of Choomai infrastructure, including:

  • CPU load and temperature
  • RAM usage
  • Network RX/TX
  • Docker container count
  • Website (nginx), VPN, and Minecraft server reachability

Has a 10 second cooldown.


/verify

Initiates a member verification process to gain access to the server.

  • Generates a unique verification link and sends it via DM
  • Requires completing a Cloudflare Turnstile CAPTCHA challenge
  • Automatically assigns the Member role upon successful verification
  • Verification links expire after 10 minutes
  • Each member can only verify 3 times before being disabled for 6 hours

/vc

Creates and manages private voice channels.

Subcommand Description
new <user> [category] [hidden] Create a private VC for yourself and one other user. hidden (default: true) hides it from the channel list entirely; set to false to show it with a locked icon instead.
add <user> <vc> Allow an additional user to join an existing private VC.
remove <user> <vc> Remove a previously allowed user from a private VC.
purge Delete all empty private VCs. Requires Manage Channels permission.

Private VCs are automatically deleted once they have been empty for 5 minutes.


/wol <ip> <port> <mac>

Sends a Wake-on-LAN magic packet to a device on your network.

  • ip: IP address or hostname of the target
  • mac: MAC address of the target device (e.g. AA:BB:CC:DD:EE:FF)
  • port: UDP port to send the packet to (1–65535)

Auto-moderation

The bot automatically times out members who join and leave a voice channel within 5 seconds, issuing a 10 minutes timeout. Members with the Manage Channels permission are exempt. The action is logged to the configured log channel.