Link to courses that are referenced in /course #206

Open
opened 2026-06-19 07:24:43 +00:00 by TenType · 0 comments
TenType commented 2026-06-19 07:24:43 +00:00 (Migrated from codeberg.org)

Objective

Whenever a course code appears in a course's description, prereqs, or coreqs, link ScottyLabs' corresponding course website.

This should support both xx-xxx and xxxxx formats (with or without a dash), but keep in mind the ScottyLabs link will only work with xx-xxx, so you might need to reformat.

For example, /course 15-122 returns an embed with

... This course prepares students for 15-213 and 15-210. ...

These two course codes should be linked like so:

... This course prepares students for 15-213 and 15-210. ...

Suggested Approach

Edit src/commands/course.ts. Import SCOTTYLABS_URL from constants.ts and the hyperlink function from discord.js.

You may find it helpful to use the string replace function with a regular expression.

## Objective Whenever a course code appears in a course's description, prereqs, or coreqs, link ScottyLabs' corresponding course website. This should support both `xx-xxx` and `xxxxx` formats (with or without a dash), but keep in mind the ScottyLabs link will only work with `xx-xxx`, so you might need to reformat. For example, `/course 15-122` returns an embed with > ... This course prepares students for 15-213 and 15-210. ... These two course codes should be linked like so: > ... This course prepares students for [15-213](https://www.courses.scottylabs.org/course/15-213) and [15-210](https://www.courses.scottylabs.org/course/15-210). ... ## Suggested Approach Edit `src/commands/course.ts`. Import `SCOTTYLABS_URL` from `constants.ts` and the `hyperlink` function from discord.js. You may find it helpful to use the string [`replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) function with a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ScottyLabs/dalmatian#206
No description provided.