Discord플랫폼의 홍익대학교 학식정보 웹훅 소스코드입니다
-
git clone this project
git clone https://github.com/J-hoplin1/Hongik-Meal-Hook.git
-
Complete application config. Yet sejong campus supported
- scheduler : Crontab Expression
- hook : Please follow format as under below. You can view supported types of campus here
... "hook": [ { "hook" : "Your discord web hook endpoint", "campus" : "Supported Campus" } ] ...
- JSON under below is example of config file
{ "scheduler": "30 10 * * *", "hook": [ { "hook": "discord hook url", "campus": "sejong" } ] }
-
Build docker
docker build -t (image name) .
-
Run docker container.
- Mountable container volume
- /app/dist/logfile : logfiles directory
docker run -d --name (container name) -v (location you want to mount):/app/dist/logfile (image name)
- Mountable container volume
I'm planning to add support for Seoul Campus in the future, but if you want to make a contribution before the next update, please make Pull Request according to the following provisions.
-
Add campus scraper's file in
src/app
-
Write and export campus' scraper file. **You need to make class that extends
Scraper
abstract class which is located insrc/app/scraper.ts
- You need to implement abstract method
scrape()
, which is async function and return MealProcess type
class SeoulCampus extends Scraper { constructor() { super() } public async scrape(): Promise<MealProcess> { // implement method } } export default SeoulCampus
- You need to implement abstract method
-
Add campus name in
SupportedCampus
as union typetype SupportedCampus = 'sejong' | (campus name to add)
-
Add campus and it's scraper instance in discord.ts. key should be same name you've write in step 3 and value should be instance that extend Scraper
const scrapers: CampusScraperMap = { sejong: new SejongScrape(), (campus name): new ("Some scraper class")() }
-
Other types of PR is also welcome.