-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (23 loc) · 1003 Bytes
/
index.js
File metadata and controls
26 lines (23 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const SCHOOL = 'GIBZ Zug'
const CLASS = 'INFAWU2'
const WebUntisLib = require('webuntis');
const untis = new WebUntisLib.WebUntisAnonymousAuth(SCHOOL, 'mese.webuntis.com');
untis
.login()
.then(() => {
return untis.getClasses();
})
.then((classes) => {
// Get timetable for the first class
const ourClass = classes.filter(classElement => classElement.name === CLASS)[0]
return untis.getTimetableForToday(ourClass.id, WebUntisLib.TYPES.CLASS);
//return untis.getTimetableForWeek(new Date(), ourClass.id, WebUntisLib.TYPES.CLASS, 1)
})
.then((timetable) => {
let output = `## ${timetable[0].kl[0].name} ##\n------------------------------------------------------\n`
for (const lesson of timetable) {
output += `| ${lesson.startTime}\t|\n|-------|\t${lesson.su[0].name}\t${lesson.te[0].longname}\t${lesson.ro[0].name}\n| ${lesson.endTime}\t|\n`
output += "------------------------------------------------------\n"
}
console.log(output)
});