Skip to content

Conversation

@ZYancey
Copy link
Contributor

@ZYancey ZYancey commented Oct 23, 2025

Ports https://github.com/ZYancey/BYU-Room-Finder-Python-Backend From Postgresql to sqlite to be compatible with our bot's existing DB and ports the entire codebase from Python to Typescript. This was a pain to do but I've done a bunch of testing and the accuracy of the roomfinder actually went up quite a bit as a result of the port.
image

The scraper is also functional but in an effort to not spam BYU servers, you can seed the scraper folder with this pre-scraped data and it will seed the DB as expected.
scraper.zip

Additionally, now that the scraper lives in CSBot code I added a simple cron to run the scraper at 2am on Sundays, if it is still the same term as the last scrape, it won't pull any new files unless rooms have been added to the schedule. That being said, I also added an admin only scrape command that fires off the scraper manually.
Screenshot 2025-10-22 at 8 29 23 PM

@ZYancey ZYancey requested a review from a team October 23, 2025 02:31
@ZYancey ZYancey self-assigned this Oct 23, 2025
@ZYancey ZYancey added this to CS Bot Oct 23, 2025
@ZYancey ZYancey moved this to Code Review in CS Bot Oct 23, 2025
Copy link
Contributor

@AverageHelper AverageHelper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still going through this, but I found a few things to start with:

*/
async function getRoomInfo(yearTerm: string, building: string, room: string): Promise<RoomInfo> {
const html = await openOrDownloadFile(yearTerm, `${building}-${room}.html`, async () => {
const response = await axios.post(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can avoid the additional dependency on axios if we use the built-in fetch API instead


### /scraperooms

**[Admin Only]** Manually triggers the room finder data scraper to update the database with current semester schedule information. This is useful for forcing an immediate update without waiting for the automatic Sunday schedule. Takes 10-15 minutes to complete and runs in the background. Shows real-time progress if a scrape is already running.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**[Admin Only]** Manually triggers the room finder data scraper to update the database with current semester schedule information. This is useful for forcing an immediate update without waiting for the automatic Sunday schedule. Takes 10-15 minutes to complete and runs in the background. Shows real-time progress if a scrape is already running.
**[Admin Only by default]** Manually triggers the room finder data scraper to update the database with current semester schedule information. This is useful for forcing an immediate update without waiting for the automatic Sunday schedule. Takes 10-15 minutes to complete and runs in the background. Shows real-time progress if a scrape is already running.

- **between** - Find rooms available during a time range on specific day(s)
- **when** - Check when a specific room is next available

The room finder automatically updates its database every Sunday at 2 AM to stay current with the semester schedule.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The room finder automatically updates its database every Sunday at 2 AM to stay current with the semester schedule.
The room finder automatically updates its database every Sunday at 2 AM to stay current with the semester schedule. Use [`/scraperooms`](#scraperooms) to update the database manually.

.setFooter({
text: 'BYU Room Finder',
// Going to locally host this on my server soon, I'll make that change when I come back and add thumbnails for the building searches
text: 'BYU Room Finder (Native)',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

normal users don't usually care about this implementation detail, imo

Suggested change
text: 'BYU Room Finder (Native)',
text: 'BYU Room Finder',

Comment on lines +5 to +7
SlashCommandSubcommandBuilder,
SlashCommandStringOption,
SlashCommandNumberOption,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SlashCommandSubcommandBuilder,
SlashCommandStringOption,
SlashCommandNumberOption,
type SlashCommandSubcommandBuilder,
type SlashCommandStringOption,
type SlashCommandNumberOption,

@AverageHelper AverageHelper linked an issue Dec 6, 2025 that may be closed by this pull request
@AverageHelper AverageHelper added the enhancement New feature or request label Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Code Review

Development

Successfully merging this pull request may close these issues.

Roomfinder TS Native Port

3 participants