Email verification and AI-powered event feed for the UTM Johor Bahru Community Discord.
The official bot for the UTMJBC Discord server. It delivers three core features:
- Email Verification - Students enter their official university email (
@graduate.utm.myor@utm.my), receive a secure 6-digit OTP via nodemailer, and are automatically assigned Discord roles based on domain verification. - Telegram Event Scraper - Monitors public UTM Telegram channels and utilizes Gemini models via Google's modern
@google/genaiSDK 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. - Grounded Campus Assistant (
/askai) - An interactive Discord AI assistant that answers student queries strictly grounded in authoritative institutional sources (utm.myandutm.gitbook.io), with sources linked at the end of each message.
- Unified AIGateway & Circuit Breaker: All AI interactions pass through a centralized service wrapper (
AIGateway) with automatedPromise.racetimeouts (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).
Full documentation is available at the project docs site:
mkdir utmjbc-bot && cd utmjbc-bot
mkdir config dataCreate 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-stoppeddocker compose up -dRequirements: 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| 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.
Type email in the console to toggle verbose SMTP error logging.
- mrc2rules — GitHub
Based on EmailVerify by Lars Kaesberg.
