@aberoth-community/overheard
TypeScript icon, indicating that this package has built-in type declarations

3.0.3 • Public • Published

@aberoth-community/overheard

Discord GitHub Actions Workflow Status NPM Version GitHubStars

A simple & portable "Aberoth Overheard" scraper library and cli.

Installation:

Npm:

client ...
npm npm i @aberoth-community/overheard
pnpm pnpm i @aberoth-community/overheard
yarn yarn add @aberoth-community/overheard

Executables:

(See: Releases)

For convenience overheard can also be downloaded as a standalone executable.

Usage:

Command-Line:

$ ./overheard --help
Usage: overheard [options]

Options:
  -h, --header [values...]  add request headers.
  -i, --interval <int>      set scan interval.
  -v, --version             output the version number
  --help                    display help for command

Example:

(See: Api-Docs, examples/webhook.js)

import Overheard from '@aberoth-community/overheard'

// main
void (async () => {
  const overheard = new Overheard(
    // scraper options
    { headers: {}, interval: 30e3 },
    // scraper cache (optional)
    {
      online: 50,
      moon: 'full',
      realms: {
        [Overheard.OVERHEARD_SCHOOLS.yellow]: 'dark',
      },
    },
  )

  // start the scraper loop
  overheard.start()
  // stop scraper
  overheard.stop()

  // === events ===
  overheard.addEventListener('error', (event) => {
    console.error(event.error)
  })
  overheard.addEventListener('exit', (event) => {
    console.log('exit!')
  })
  overheard.addEventListener('moon', (event) => {
    console.log(`moon: ${event.phase}`)
  })
  overheard.addEventListener('realm', (event) => {
    console.log(`scroll: ${event.name} ${event.phase}`)
  })

  // === getters ===
  console.log(overheard.getRealms()) // [{ name: 'white', school: 'divination', phase: 'dark' }, ...]
  console.log(overheard.getMoon()) // nearly_full
  console.log(overheard.getOnline()) // 100
})()

Readme

Keywords

Package Sidebar

Install

npm i @aberoth-community/overheard

Weekly Downloads

1

Version

3.0.3

License

MIT

Unpacked Size

24.7 kB

Total Files

12

Last publish

Collaborators

  • ashnel3