https://github.com/ruelalarcon/usask_class_notifier
A Discord bot that monitors University of Saskatchewan class seat availability and notifies users when seats become available.
https://github.com/ruelalarcon/usask_class_notifier
bot discord python usask
Last synced: about 2 months ago
JSON representation
A Discord bot that monitors University of Saskatchewan class seat availability and notifies users when seats become available.
- Host: GitHub
- URL: https://github.com/ruelalarcon/usask_class_notifier
- Owner: ruelalarcon
- License: mit
- Created: 2025-06-11T19:05:56.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-20T21:12:38.000Z (12 months ago)
- Last Synced: 2025-07-20T22:21:34.644Z (12 months ago)
- Topics: bot, discord, python, usask
- Language: Python
- Homepage:
- Size: 85.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Class Notifier Discord Bot
> A Discord bot that monitors University of Saskatchewan class seat availability and notifies users when seats become available.
## Preview

## Setup
1. **Install dependencies:**
```bash
pip install -r requirements.txt
```
2. **Create a Discord Bot:**
- Go to https://discord.com/developers/applications
- Create a new application
- Go to the "Bot" section
- Create a bot and copy the token
- Enable "Message Content Intent" in the bot settings
3. **Configure the bot:**
- Replace `'YOUR_BOT_TOKEN'` and `CLASS_REGISTRAR_COOKIES` in `config.py` with your actual bot token
- Add your Discord user ID to the `DEVELOPERS` list in `config.py` to use developer commands
- An example config file can be found in `config.py.example`
4. **Invite bot to your server:**
- Go to OAuth2 -> URL Generator
- Select "bot" scope and "View Channels", "Send Messages", "Read Message History", "Mention Everyone" permissions
- Use the generated URL to invite the bot to your server
5. **Run the bot:**
```bash
python discord_bot.py
```
## Commands
- `cn!help`
- Shows detailed help for all commands
- `cn!setchannel [#channel]`
- **REQUIRED FIRST STEP**: Sets the channel where seat availability notifications will be sent
- If no channel is specified, uses the current channel
- Server admins or developers only
- Example: `cn!setchannel #class-alerts` or `cn!setchannel` (uses current channel)
- `cn!add CRN SUBJECT COURSE_NUMBER YEAR TERM`
- Adds a class to be monitored and adds you to the notification list
- Example: `cn!add 12345 CMPT 332 2024 FALL`
- `cn!remove CRN`
- Stops monitoring a class
- Example: `cn!remove 12345`
- `cn!status`
- Shows seat counts for all monitored classes in the server
- Also shows which channel is set for notifications
- `cn!cookies` (Developers only)
- Shows session cookie status and refresh times
- Developers only (user ID must be in DEVELOPERS list in config.py)
- `cn!refresh` (Developers only)
- Manually refresh session cookies
- Developers only (user ID must be in DEVELOPERS list in config.py)
## Features
- Checks all monitored classes every 20 seconds
- Sends notifications when seats become available (when count goes from 0 to >0)
- Per-server class monitoring (classes are tracked separately for each Discord server)
- Persistent data storage (survives bot restarts)
- Multiple users can monitor the same class
- Automatic session cookie refresh every 5 minutes
- Robust error handling and logging
## Valid Terms
- FALL
- WINTER
- SPRING
- SUMMER
## Notes
- The bot uses the University of Saskatchewan's Banner system
- **You must run `cn!setchannel` first** before the bot can send any notifications
- Only users in the DEVELOPERS list (defined in config.py) can use developer commands
- Session cookies are automatically refreshed every 5 minutes to maintain connectivity
- All bot data including cookies are saved in `bot_data.json`
- All commands use the prefix `cn!`
- To find your Discord user ID: Enable Developer Mode in Discord settings, then right-click your username and select "Copy ID"