Skip to content

Commit c4fd8fa

Browse files
committed
Fix wrong subject/professor and undefined messageContent
1 parent 9a9e658 commit c4fd8fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/iCalReader.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ async function filterToadaysEvents(
229229
if (thisWeeksEvents[entry].day == today.getDay()) {
230230
var event = thisWeeksEvents[entry]
231231
var summary = event.summary
232-
//extract the subject after the "-" in the string
233-
var subject = summary.split("-")[1]
232+
//extract the subject after the first "-" in the string
233+
var subject = summary.split(/-(.+)/)[1]
234234

235235
//extract the professors Name before the "-" in the string
236-
var professor = summary.split("-")[0]
236+
var professor = summary.split(/-(.+)/)[0]
237237

238238
var link = extractZoomLinks(event.description)
239239

@@ -466,7 +466,7 @@ function createCron(
466466
(_channel) => _channel == channel
467467
) as TextChannel
468468
notificationChannel
469-
?.send({ content: role, embeds: [embed.setTimestamp()] })
469+
?.send({ content: role || null, embeds: [embed.setTimestamp()] })
470470
.then((msg) => {
471471
setTimeout(function () {
472472
try {

0 commit comments

Comments
 (0)