Skip to content

mrc2rules/UTMJBC-Bot

 
 

Repository files navigation


UTM JBC

UTMJBC Bot

Email verification and AI-powered event feed for the UTM Johor Bahru Community Discord.

Build Status License Forks Stars

Join Discord


About

The official bot for the UTMJBC Discord server. It delivers three core features:

  1. Email Verification - Students enter their official university email (@graduate.utm.my or @utm.my), receive a secure 6-digit OTP via nodemailer, and are automatically assigned Discord roles based on domain verification.
  2. Telegram Event Scraper - Monitors public UTM Telegram channels and utilizes Gemini models via Google's modern @google/genai SDK to intelligently classify campus events.

    Message's are passed through multilayer filter to prevent duplication. Event details are extracted via structured JSON mapping, and then published in a Discord forum channel. If required, the posts are also translated from Malay to English.
  3. Grounded Campus Assistant (/askai) - An interactive Discord AI assistant that answers student queries strictly grounded in authoritative institutional sources (utm.my and utm.gitbook.io), with sources linked at the end of each message.

Reliability & Architecture Highlights

  • Unified AIGateway & Circuit Breaker: All AI interactions pass through a centralized service wrapper (AIGateway) with automated Promise.race timeouts (20–30s) and a circuit breaker that pauses requests after repeated API outages.
  • Decoupled Prompt Management: System prompts and few-shot extraction schemas are decoupled into dedicated modules (src/prompts/), keeping core application logic clean.
  • Zero-Build Persistence: Uses pre-compiled GLIBC binary distributions of sqlite3 (^5.1.7) for seamless deployment across shared Linux servers and container environments.

Note

UTMJBC is an independent student-run community and is not affiliated with or endorsed by Universiti Teknologi Malaysia (UTM).


Documentation

Full documentation is available at the project docs site:


Self Hosting

Docker (Recommended)

mkdir utmjbc-bot && cd utmjbc-bot
mkdir config data

Create config/config.json:

{
  "token":    "<Discord Bot Token>",
  "clientId": "<Discord Bot Client ID>",
  "email":    "<Sender Email Address>",
  "username": "<SMTP Username>",
  "password": "<SMTP Password or App Password>",
  "smtpHost": "<SMTP Server, e.g. smtp.gmail.com>",
  "isGoogle": false
}

Create docker-compose.yml:

version: '3'
services:
  utmjbc-bot:
    image: ghcr.io/mrc2rules/utmjbc-bot:latest
    environment:
      - GEMINI_API_KEY=your_gemini_key
    volumes:
      - ./config:/usr/app/config
      - ./data:/usr/app/data
    ports:
      - "8181:8181"
    restart: unless-stopped
docker compose up -d

Manual Installation

Requirements: Node.js v18+

git clone https://github.com/mrc2rules/UTMJBC-Bot.git
cd UTMJBC-Bot
npm install
# fill in config/config.json (see above)
export GEMINI_API_KEY=your_key_here
npm start

Configuration Reference

Field Description
token Discord Bot Token from the Developer Portal
clientId Discord Bot Client ID
email Email address that sends verification codes
username SMTP username (usually the same as email)
password SMTP password or Gmail App Password
smtpHost SMTP server (e.g. smtp.gmail.com)
isGoogle true if using Gmail
botDbPath Directory for persistent bot.db (recommended for hosted environments)
telegramApiId From my.telegram.org — required for the event scraper
telegramApiHash From my.telegram.org
telegramPhone Phone number associated with the Telegram account
telegramSession Save the session string here after first login (printed in logs)
discordEventForumId Discord forum channel ID where events are posted
GEMINI_API_KEY (env var) Google AI API key for Gemini features

[NOTE!] Gmail: Create an App Password and set isGoogle: true.

Debugging

Type email in the console to toggle verbose SMTP error logging.


Contributors

UTMJBC Development

Original Project

Based on EmailVerify by Lars Kaesberg.


Made with ❤️ for the UTM Johor Bahru Community

Join Discord   Community Guide   Email

About

Email verification, event scraping and specialized AI powered query bot for UTM JBC Discord

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 99.6%
  • Dockerfile 0.4%