Skip to content

Discord / Slack Hook : Hongik Univ Sejong meal information web-hook

Notifications You must be signed in to change notification settings

J-Hoplin/Hongik-Meal-Hook

Repository files navigation

Hongik Univ. Sejong Meal-Hook for Discord and Slack


Discord플랫폼의 홍익대학교 학식정보 웹훅 소스코드입니다


How to use?

  1. git clone this project

    git clone https://github.com/J-hoplin1/Hongik-Meal-Hook.git
  2. 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"
              }
          ]
      }
  3. Build docker

    docker build -t (image name) .
  4. 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)

How to contribute?

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.

  1. Add campus scraper's file in src/app

  2. Write and export campus' scraper file. **You need to make class that extends Scraper abstract class which is located in src/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
  3. Add campus name in SupportedCampus as union type

    type SupportedCampus = 'sejong' | (campus name to add)
  4. 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")()
    }
  5. Other types of PR is also welcome.

About

Discord / Slack Hook : Hongik Univ Sejong meal information web-hook

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published