-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This gets the Substition table for the current day
- Loading branch information
1 parent
f07b966
commit c7532f7
Showing
2 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import needle from 'needle'; | ||
import fs from 'fs'; | ||
import { SlashCommandBuilder } from '@discordjs/builders'; | ||
const updateCookies = require('../../index'); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder().setName('vertretung').setDescription('Schickt den Vertretungsplan'), | ||
async execute(interaction) { | ||
updateCookies.updateCookies(true); | ||
needle('get', process.env.iserv_url + 'iserv/plan/show/raw/Vertretungsplan%20Sek1%20Heute/subst_001.htm', { | ||
cookies: JSON.parse(fs.readFileSync('./././data.json', 'utf-8')), | ||
}) | ||
.then(function (resp) { | ||
if (resp.statusCode !== 200) { | ||
console.log('Login failed with statuscode ' + resp.statusCode); | ||
return interaction.reply('Es ist ein Fehler aufgetreten'); | ||
} else { | ||
process.env.iserv_console && console.log('Get Sub Table Sucessfull'); | ||
interaction.reply('Get Sub Table Sucessfull'); | ||
} | ||
}) | ||
.catch(function (err) { | ||
console.log(err); | ||
return err; | ||
}); | ||
return; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters