bfd-api-redux
Advanced tools
Comparing version 1.1.1 to 1.2.0
{ | ||
"name": "bfd-api-redux", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A node.js wrapper for the Bots For Discord API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,3 +12,3 @@ ## NOTICE & INFO | ||
``` | ||
**NOTE:** *Everything has to be used inside async functions with an `await`, for example:* | ||
**NOTE:** *If you do now wish to use callbacks, then all actions must be used inside async functions with an `await`, for example:* | ||
```js | ||
@@ -20,12 +20,3 @@ async function user() { | ||
``` | ||
All of the following functions only require `id`, which is the ID of the bot/user that is being searched and return a JSON object when done: | ||
```js | ||
api.getUser('254287885585350666') //requires user ID | ||
api.getUserBots('254287885585350666') //requires user ID | ||
api.getBot('621352902656524288') //requires bot ID | ||
api.getWidget('621352902656524288') //requires bot ID | ||
api.getVotes() //Automatically gets your votes, no input required | ||
``` | ||
You can easily update your Bot's guild count using this function: | ||
@@ -40,5 +31,4 @@ ```js | ||
### Get votes | ||
With callback | ||
```js | ||
api.getVotes().then(votes => { | ||
api.getVotes12().then(votes => { | ||
console.log(votes) | ||
@@ -48,9 +38,30 @@ }) | ||
Without callback | ||
### Get user | ||
```js | ||
async function votes() { | ||
console.log(await api.getVotes()); | ||
} | ||
votes(); | ||
api.getUser("254287885585350666").then(user => { | ||
console.log(user) | ||
}) | ||
``` | ||
### Get user bots | ||
```js | ||
api.getUserBots("254287885585350666").then(bots => { | ||
console.log(bots) | ||
}) | ||
``` | ||
### Get bot | ||
```js | ||
api.getUser("621352902656524288").then(bot => { | ||
console.log(bot) | ||
}) | ||
``` | ||
### Get widget | ||
```js | ||
api.getWidget("621352902656524288").then(widget => { | ||
console.log(widget) | ||
}) | ||
``` | ||
@@ -49,17 +49,3 @@ const EventEmitter = require("events"); | ||
return new Promise((resolve, reject) => { | ||
https.get({ | ||
hostname: 'discords.com', | ||
path: `/bots/api/bot/${id}/votes`, | ||
headers: { | ||
Authorization: token, | ||
"Content-Type": "application/json" | ||
}, | ||
parse: "json" | ||
}, async (res) => { | ||
res.on('data', (d) => { | ||
resolve(JSON.parse(d.toString("utf-8"))); | ||
}); | ||
}).on('error', (e) => { | ||
reject(e); | ||
}) | ||
reject ("This endpoint has been deprecated - please update to getVotes12()"); | ||
}) | ||
@@ -66,0 +52,0 @@ } |
64
6371
132