adlapi.js
v1.0.1
Published
A official package to use Abstract Discord List API
Downloads
5
Maintainers
Readme
adlapi.js
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
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!