Socket
Socket
Sign inDemoInstall

dblapi.js

Package Overview
Dependencies
1
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "dblapi.js",
"version": "2.0.0",
"version": "2.0.1",
"description": "An official module for interacting with the discordbots.org API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -11,2 +11,4 @@ # dblapi.js

## Example
### Example of posting server count with supported libraries (Discord.js and Eris)
```js

@@ -16,16 +18,15 @@ const Discord = require("discord.js");

const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token');
const dbl = new DBL('Your discordbots.org token', client);
```
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800000);
### Example of using webhooks to receive vote updates
```js
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
```
or we can take care of stat posting for you (discord.js / Eris)
```js
const Discord = require("discord.js");
const client = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('Your discordbots.org token', client);
dbl.webhook.on('vote', vote => {
console.log(`User with ID ${vote.user} just voted!`);
});
```
export = DBLAPI;
declare class DBLAPI {
constructor(token: string, options?: DBLAPI.DBLOptions, client?: any)
constructor(token: string, options: DBLAPI.DBLOptions, client?: object);
constructor(token: string, client?: object);

@@ -11,3 +12,3 @@ public postStats(serverCount: number, shardId?: number, shardCount?: number): Promise<Buffer>

public getBots(query: DBLAPI.BotsQuery): Promise<DBLAPI.BotSearchResult>
public getVotes(): Promise<DBLAPI.Votes[]>
public getVotes(): Promise<DBLAPI.Vote[]>
public hasVoted(id: string): Promise<boolean>

@@ -17,3 +18,3 @@

private _request(method: string, endpoint: string, data?: Object, auth?: boolean): Promise<Object>
private _request(method: string, endpoint: string, data?: object, auth?: boolean): Promise<object>
}

@@ -99,3 +100,3 @@

export type BotsQuery ={
export type BotsQuery = {
limit?: number;

@@ -116,3 +117,3 @@ offset?: number;

export type Votes = {
export type Vote = {
username: string;

@@ -119,0 +120,0 @@ discriminator: string;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc