/draconis-webhook

WebHook that posts new events from WoW guild calendar

Primary LanguageTypeScriptMIT LicenseMIT

This project is DEPRECATED

The guild events URL https://eu.battle.net/wow/en/vault/character/event doesn't exist anymore.

draconis-webhook

This WebHook sends new guild events to a Discord channel.

Discord preview

How it works ?

Since Blizzard still does not offer in its public API the ability to retrieve data from the guild calendar , this project scrapes the page: https://eu.battle.net/wow/en/vault/character/event to get the guild events.

Steps

  1. Puppeteer go to https://eu.battle.net/wow/en/vault/character/event
  2. Log in using BLIZZARD_EMAIL and BLIZZARD_PASSWORD environment variables

Blizzard Login page

  1. Scrap all the .event-summary li element

Event list

  1. Filter guild events with the getGuildEvents() function
  2. Save the events under an events.json file, if the file does not exist it assumes it's the first crawl and it will sends ALL the current events to catch up
  3. Wait for the interval
  4. Crawl again, diff between the events.json and the new JSON and send ONLY the new events
  5. Repeat

Setup

Environment variables

  • DISCORD_WEBHOOK_URL Events will be POSTed at this URL
  • BLIZZARD_EMAIL Needed to log in to the events page
  • BLIZZARD_PASSWORD Needed to log in to the events page
  • GUILD_NAME It is used for the Discord embed message
  • GUILD_THUMBNAIL_URL It is used for the Discord embed thumbnail
  • INTERVAL It will run the crawl every INTERVAL minutes
  • DEV If set to a truthy value it will run Puppeteer in headful mode and it will not send requests to the WebHook (only print them in the console)

Run the project

  1. Clone the repo
  2. yarn or npm install
  3. npm run start to run the bot once
  4. npm run dev will build watch and run nodemon

Tests

npm run test or npm run test:watch

Tech stack