adlapi.js
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

adlapi.js

Codacy Badge All Contributors License Downloads Package Size https://nodei.co/npm/adlapi.js.png?downloads=true&downloadRank=true&stars=true

A official package to use Abstract Discord List API. The package is ment to be universal, hence why it uses functions to be able to get your bot's stats without requiring you to specify the client.

Installation

Use yarn or npm to install.

NPM:

npm install adlapi.js

Yarn:

yarn add adlapi.js

Example

Our package is made so you could essentially use any JavaScript-based Discord library, hence why it requires you as the developer to use a function.

const Discord = require('discord.js');
const client = new Discord.Client();
const adlapi = require('adlapi.js');
const adl = new adlapi('Your ADL token', client.user.id, {
  universal: {
    users: () => client.users.size,
    servers: () => client.guilds.size,
    /** Shards is optional, example code below
     * shards: () => client.shard.count,
     */
  },
});

// Optional events
adl.on('posted', res => {
  console.log('Posted stats', res);
});

adl.on('error', err => {
  console.error(`An error occured: ${err}`);
});

client.on('ready', () => {
  // Post current stats to the API
  adl.postStats();

  // Every 30 minutes post new stats
  setInterval(() => {
    adl.postStats();
  }, 1000 * 60 * 30); // 30 minutes
});

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

GNU GPLv3

Contributors ✨

Thanks goes to these wonderful people (emoji key):


dicedtomato

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Package Sidebar

Install

npm i adlapi.js

Weekly Downloads

2

Version

1.0.1

License

GPL-3.0

Unpacked Size

45.7 kB

Total Files

7

Last publish

Collaborators

  • tom-beijner