ReminderBot β Telegram Prayer Time Reminder Bot
ReminderBot is a feature-rich Telegram bot that reminds users of daily Islamic prayer times. It works in both private chats and group chats, configurable notifications, inline queries, daily Quran verses, hadith browser, Quran references, fasting reminders, regional prayer time search, statistics tracking, and more. Built with Node.js, grammY, MongoDB, and TypeScript.
- Region-based prayer times β users select their region on first start.
- Fasting mode β customized messages for Suhoor (Fajr) and Iftar (Maghrib).
- Configurable prayer notifications β individually toggle alerts for Fajr, Sunrise, Dhuhr, Asr, Maghrib, and Isha.
- Daily prayer time reminders sent automatically every morning.
- Friday special β a Juma Mubarak image is sent instead of a plain text message on Fridays.
- Daily Quran verse β a random Quran verse (Arabic + Uzbek translation) is appended to every daily reminder.
- Hadith browser β browse hadiths interactively.
- Quran & Tafsir β access Quran verses and their commentary.
- Regional search β fuzzy-search prayer times by city/region name.
- Location update β change your region at any time.
- Feedback β submit suggestions or complaints directly through the bot.
- Statistics β view bot usage and engagement stats.
- Source β view the data source used for prayer times.
- Inline query β query prayer times from any chat without opening the bot.
- Group registration β when the bot is added to a group, it automatically starts the region-selection flow.
- Group region setup (
GroupStartscene) β admin selects the group's region via paginated inline keyboard; prayer times are shown immediately after selection. - Group location update (
GroupLocationscene) β change the group's region at any time using/location. - Daily group reminders β groups receive the same daily prayer time message as private users (without fasting-specific content).
- Friday Juma image β groups also receive the Juma Mubarak photo on Fridays.
- Auto-deactivation β when the bot is removed from a group, the group is automatically marked inactive and stops receiving messages.
- In-memory group cache β group data is cached in memory for fast access without repeated DB queries.
server.ts β Bot entry point, middleware, command routing, webhook/polling setup
scenes/ β grammY scene handlers (one file per feature flow)
cron/cron.ts β Scheduled jobs: daily reminders, prayer-time alerts (computed via adhan)
config/database.ts β Mongoose models (User, Hadith, Quran, Group)
config/i18n.ts β i18next internationalization setup
config/regions.json β Static region data (coordinates, names, IDs)
config/storage.ts β In-memory session storage (grammY MemorySessionStorage)
helper/ β Error handler, Quran verse fetcher, hadith fetcher, HTML helpers, keyboard mapper
keyboard/ β Inline and custom keyboard builders
middlewares/auth.ts β User and group auth middleware (auto-create/load from DB or cache)
query/inline.ts β Inline query handler
translate/ β i18n translation files (Uzbek)
types/ β TypeScript interfaces (database models, bot context, i18next resources)
utils/ β Constants, env validation (Zod), enums, dayjs config, prayer time computation (adhan)
erDiagram
USER {
number userId PK "Telegram user ID"
string userName "Telegram username"
string name "First name"
boolean fasting "Fasting mode enabled"
string region "Region display name"
number regionId "Region numeric ID"
number donate "Donation amount"
boolean status "Active / soft-deleted"
object notificationSetting "Per-prayer toggle flags"
date deletedAt "Soft-delete timestamp"
}
NOTIFICATION_SETTING {
boolean fajr
boolean sunrise
boolean dhuhr
boolean asr
boolean maghrib
boolean isha
}
HADITH {
string content "Hadith text"
string category "Hadith category/topic"
}
QURAN {
number surah "Surah number"
number ayah "Ayah number"
string origin "Original Arabic text"
string uzbek "Uzbek translation"
}
GROUP {
number groupId PK "Telegram group/supergroup ID"
string groupName "Group title"
string region "Region display name"
number regionId "Region numeric ID"
boolean status "Active (bot is member)"
string type "group | supergroup"
}
USER ||--|| NOTIFICATION_SETTING : "has"
Note: Prayer times are no longer stored in the database. They are computed at runtime using the adhan library with region coordinates from
config/regions.json.
| Schedule | Job | Description |
|---|---|---|
0 1 * * * (daily) |
daily() + reminder() |
Sends morning prayer time summaries to all active users & groups; reschedules per-prayer alerts |
| Per-prayer time | reminder() |
Sends individual prayer-time alerts (Fajr, Sunrise, Dhuhr, Asr, Maghrib, Isha) based on each region's exact times |
| Command | Description |
|---|---|
/start |
Register and set up region & fasting preference |
/location |
Change your region |
/notification |
Toggle per-prayer notifications |
/fasting |
Toggle fasting mode |
/search |
Search prayer times by region name |
/hadith |
Browse hadiths |
/quran |
Access Quran & Tafsir |
/source |
View prayer time data source |
/statistic |
View bot statistics |
/feedback |
Send feedback to the team |
| Command | Description |
|---|---|
/start |
Activate the bot in the group |
/location |
Change the group's prayer time region |
Ensure you have pnpm installed:
npm install -g pnpmClone the repository:
git clone https://github.com/Xayrulloh/ReminderBot.git
cd ReminderBotInstall dependencies:
pnpm installCopy .env.example to .env and fill in the values:
cp .env.example .env| Variable | Description |
|---|---|
NODE_ENV |
local, dev, or prod |
TOKEN |
Telegram Bot API token from @BotFather |
MONGO_URL |
MongoDB connection string |
PAYME_URL / PAYME_ENDPOINT / CARD |
Payment integration (optional) |
DISCORD_WEBHOOK_URL |
Discord webhook for logging |
DISCORD_LOGS_THREAD_ID |
Discord thread ID for general logs |
DISCORD_FLOOD_THREAD_ID |
Discord thread ID for flood/unknown messages |
DISCORD_FEEDBACK_THREAD_ID |
Discord thread ID for user feedback |
SESSION_TTL |
Session TTL in milliseconds |
WEBHOOK_PORT |
Port for the Fastify webhook server |
WEBHOOK_URL |
Public HTTPS URL for the webhook |
WEBHOOK_ENABLED |
true to use webhook mode, false for long-polling |
QURON_VA_TAFSIRI_URL |
Quran & Tafsir API URL |
Development mode (auto-recompile on change):
pnpm run start:devProduction mode (build then start):
pnpm run build
pnpm start| Layer | Technology |
|---|---|
| Runtime | Node.js 24.x |
| Language | TypeScript 5.x |
| Bot Framework | grammY + grammy-scenes |
| Database | MongoDB via Mongoose |
| Prayer Times | adhan (coordinate-based computation) |
| i18n | i18next |
| Scheduler | node-cron + node-schedule |
| HTTP Server | Fastify (webhook mode) |
| Logging | Discord Webhooks (discord.js) |
| Validation | Zod |
| Linter | Biome |
| Package Manager | pnpm 10.x |
This project is licensed under the MIT License β see the LICENSE.txt file for details.
Security Note: Never commit your
.envfile or share your bot token publicly. Keep all secrets out of version control.