Skip to content

BananaJeanss/ralseibot

Ralseibot Banner

A Discord Bot for all your Ralsei-related needs, built with TypeScript and Discord.js


Discord Discord Website

License: MIT Discord.js TypeScript Node.js GitHub stars Deploy to Nest Health


Features

  • Multi-purpose commands: Includes a variety of commands, such as /ralsei, /dice, /ralseify, /mike, /textbox, and many more viewable via commands.md.
  • Basic Express Site: Runs a basic Express site alongside the bot to display basic commands, uptime, and links.
  • Rotating Statuses: Features a list of rotating status messages configurable via statuses.json
  • Content Filtering: Filters out potentially harmful content in commands such as /ralsei
  • Ratelimits: Per-command ratelimits to prevent spam

List of Commands

Command Description
/ralsei Fetches a random Ralsei image from Reddit or Twitter
/ralsei-sprite Get a random Ralsei sprite
/textbox Generate Deltarune textboxes with custom text and sprites
/ping Basic responsiveness check
/uptime View bot uptime statistics
/about View information about the bot

Note

More commands can be found via the discord command selector, or via commands.md

Quick Start

Prerequisites

Local Installation

  1. Clone the repository

    git clone https://github.com/BananaJeanss/ralseibot.git
    cd ralseibot
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.example .env

Important

Make sure to edit .env with your Discord bot token and client ID, and Reddit app client ID and secret, otherwise the bot won't work.

  1. Extract sprites (optional for /ralsei-sprite)

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    pip install -r static/sprites/requirements.txt
    npm run extract-sprites
  2. Build and deploy commands

    npm run build
    npm run deploy-commands
  3. Start the bot

    npm start

Configuration

Environment Variables

# Required
DISCORD_BOT_TOKEN=your_bot_token_here
DISCORD_CLIENT_ID=your_client_id_here

# Required for Reddit handler to work (/ralsei)
REDDIT_CLIENT_ID=
REDDIT_CLIENT_SECRET=

# Optional, but recommended that you set these.
RUN_MODE=dual  # bot, site, or dual
EXPRESS_PORT=3000

Content Sources

You can configure content sources in sources.yaml, make sure a handler exists for it in the handlers/ folder.

sources:
  reddit:
    - name: "r/ralsei"
      url: "/r/ralsei/"
      weight: 5
  twitter:
    - name: "Bi-Hourly Ralsei"
      url: "https://x.com/bihourlyralsei"
      weight: 5

Radio

/radio plays songs from the radio/songs/ folder in a voice channel. You can add your own songs in mp3 format to this folder, and they will be picked randomly when the command is used.

Development

Scripts

  • npm run dev - Starts a development server with hot reload using tsx
  • npm run build - Builds TypeScript to JavaScript to dist/
  • npm run deploy-commands - Deploys commands in dist/ to your Discord bot (required for commands to be accessible)
  • npm run copy-static - Copies over static files (such as html, sprites, etc) to dist/ folder
  • npm run lint - Runs ESLint (current config may be broken, use with caution)

Project Structure

src/
├── commands/          # Discord slash commands
│   ├── ralsei/        # General/Ralsei commands
│   └── utility/       # Utility commands
├── events/            # General event handlers
├── handlers/          # Content source handlers (e.g. Reddit, Twitter)
├── site/              # Express site
└── index.ts           # Main entry point

Contributing

Contributions are welcome! Please feel free to:

Make sure your contribution follows the general guidelines, and if you're opening a pull request, that it isn't being worked on by someone else already.

For more information, read the CONTRIBUTING.md file.

Contributors:

contributors

License

This project is licensed under the MIT License, see the LICENSE file for details.

Credits

Made for https://converge.hackclub.com/