A Telegram bot that monitors university announcement pages and sends notifications to Telegram groups.
- Multi-source monitoring: Monitor multiple announcement pages simultaneously
- Age-based filtering: Only sends announcements from the last 3 days (configurable)
- Source differentiation: Visual icons distinguish CS department (🖥️) from university (🏛️) announcements
- Persistent tracking: Remembers sent announcements across restarts
- Smart hashtags: Automatically tags announcements based on keywords
- HTML formatting: Clean, formatted messages with preview content
Edit config.json to add or modify announcement sources:
{
"announcement_sources": [
{
"name": "main",
"url": "https://fmi.univ-tiaret.dz/index.php"
},
{
"name": "other_page",
"url": "https://example.com/announcements"
}
],
"loop_time_seconds": 900,
"bot_owner_id": "YOUR_TELEGRAM_ID"
}Each source requires:
name: Unique identifier for the source (used in tracking)url: Full URL of the announcement page
Set these as Replit Secrets or environment variables:
BOT_TOKEN: Your Telegram bot tokenGROUPS_IDS: Comma-separated list of Telegram group IDsPROXY_IP: (Optional) Proxy server IPPROXY_PORT: (Optional) Proxy server port
The bot automatically filters announcements based on their age:
- Only announcements from the last 3 days are sent to Telegram groups
- Older announcements are ignored to prevent spam from outdated content
- The age limit is configurable via
MAX_ANNOUNCEMENT_AGE_DAYSinmain.py - If a date cannot be parsed, the announcement is included (fail-safe behavior)
Each announcement source has a unique icon for easy identification:
- 🖥️ CS Department: Computer Science department announcements
- 🏛️ University: Main university announcements
- Icons appear in the message header to quickly distinguish the source
Each announcement is assigned a unique ID in the format:
{source_name}:{title}_{date}
This prevents:
- Duplicate notifications when the bot restarts
- ID conflicts between different sources
- Re-sending old announcements
The bot maintains a seen_announcements.json file that stores all previously sent announcement IDs. This file persists across restarts, ensuring announcements are only sent once.
The bot looks for table rows with this specific structure:
<tr>
<td style="border: 1px solid #ababab; text-align: center;">
<strong>Title</strong>
<p>Content...</p>
</td>
<td>Date</td>
</tr>- Ensure the new page uses the same HTML structure
- Add the source to
config.json:{ "name": "department_news", "url": "https://your-university.edu/dept/news" } - Restart the bot
The bot will automatically:
- Start monitoring the new source
- Track announcements separately by source
- Display the source name in notifications
On first startup, the bot:
- Loads all current announcements from all sources
- Sends only the latest announcement
- Marks all others as "seen" to avoid spam
- From then on, only sends new announcements
📢 🖥️ New CS Department Announcement! 🖥️ 📢
#Exams #Important
📌 Title: Planning examens Semestre 2
🗓️ Date: 06/02/2026
📡 Source: CS department
📝 Details:
Le planning des examens du semestre 2 est disponible
Consultez le tableau pour les dates et horaires
…
Visit the Announcements Page
📢 🏛️ New University Announcement! 🏛️ 📢
#Results
📌 Title: Résultats Master1
🗓️ Date: 07/02/2026
📡 Source: main
📝 Details:
Les résultats sont affichés
…
Visit the Announcements Page
Run the cleanup script to remove old announcements from the tracking file:
python3 cleanup_old_announcements.pyThis script:
- Removes announcements older than 3 days from
seen_announcements.json - Keeps the tracking file clean and manageable
- Safe to run periodically (will not affect current functionality)