Rust Discord

Faculty Bot for Discord


Introduction

Are you a faculty administrator looking for an easier way to manage your server? Meet Faculty Bot – a versatile and powerful Discord bot designed to streamline faculty-related administrative tasks. With this bot, you can automate user verification, meal plan updates, role management, and much more.

Whether you’re managing a small faculty group or a large educational server, Faculty Bot is equipped with features that will save you time and improve server management efficiency. Faculty Bot provides educational communities with tools for better student engagement, role-based access control, and server automation.

How to Set Up Faculty Bot for Discord

Setting up Faculty Bot is simple! Follow these steps to get the bot running on your server.

Prerequisites

Before running the bot, ensure you have Docker installed on your system. If you do not, install it through your distro’s package manager (apt, pacman, paru, brew just to name a few)

paru -S docker # <- This should already include docker compose

Next, download the docker image

docker pull ghcr.io/rndrmu/facultymanager:latest

Alternatively, you can use the following docker-compose.yml file

version: "3"
services:
    bot:
        container_name: faculty_manager
        #image: ghcr.io/rndrmu/facultymanager:latest
        build: .
        volumes:
          - './config.json:/config.json:ro'
          - './images:/images'
          - './migrations:/migrations'
        environment:
            DISCORD_TOKEN: "${DISCORD_TOKEN}"
            DATABASE_URL: "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database:5432/${POSTGRES_DB}"
            PREFIX: "${PREFIX}"
            MAILUSER: "${MAILUSER}"
            MAILPW: "${MAILPW}"
            SMTP_SERVER: "${SMTP_SERVER}"
            SMTP_PORT: "${SMTP_PORT}"
            RUST_LOG: "${RUST_LOG}"
        depends_on: [database]
        networks:
            - bot
    database:
        container_name: database
        image: postgres:13
        environment: 
            POSTGRES_USER: ${POSTGRES_USER}
            POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
            POSTGRES_DB: ${POSTGRES_DB}
        volumes:
          - ./migrations/faculty_manager.sql:/docker-entrypoint-initdb.d/init.sql
        networks:
            - bot
networks: 
    bot: {}

The ./migrations/faculty_manager.sql can be found inside the github repo -> https://github.com/rndrmu/faculty-bot/blob/master/migrations/faculty_manager.sql

Configure the Bot

To configure Faculty Bot, create a .env file with the necessary details:

DISCORD_TOKEN=
DATABASE_URL=
PREFIX=
MAILUSER=
MAILPW=
SMTP_SERVER=
SMTP_PORT=
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=
RUST_LOG=warn

You can get the bot’s Discord Token by registering an application on the Discord Developer Portal.

Running the Bot

Easiest Method: Using Docker

The fastest way to launch the bot is by using Docker. Simply edit the docker-compose.yml file and run:

docker compose -f docker-compose.yml --env-file .env up

Alternative Methods

  • The Not-so-easy Method: Use the provided launch_bot.sh (Linux/macOS) or launch_bot.ps1 (Windows) scripts to launch the bot.
  • Manual Method: Install Postgres 13, the Rust Toolchain, and configure the bot manually by running the faculty_manager.sql script to initialize the database.

Bot Settings

The bot has several settings you can adjust by editing the config.json file, including channel and role IDs. The bot is configured to interact with various channels, including:

  • logs: For logging bot activity.
  • greetings: Where new users are welcomed.
  • news: For announcements.
  • xp: For XP tracking.
  • rules: For displaying the server rules.
  • ads: For external ad management.

Adjustable Settings

  • adstimeout: Controls how long ads stay visible in the ads channel.
  • CharsForLevel: Defines the number of characters required to earn 1 XP.
  • postMealplan: Enables the meal plan posting functionality, perfect for faculty or student meal planning.

Bot Commands

Here are some of the useful commands the bot supports:

  • help: Displays general information and usage tips.
  • rulesupdate <“new rules”>: Updates server rules with ease, ensuring compliance and transparency.
  • sendmessage <“message”>: Sends a message to a specified channel.
  • verify : Verifies a student email and assigns them the verified role.
  • xp: Displays current XP, which encourages student participation and engagement.
  • register: Registers Discord Slash Commands for an enhanced user experience with instant responses.
<